Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a procedure, EvaluatePoly, to evaluate a polynomial: P(x)=Coeff(n)xn+Coeff(n1)x(n1)++Coeff(1)x+Coeff(0) at a given value of x. You are to assume that the calling routine first pushes

image text in transcribed Write a procedure, EvaluatePoly, to evaluate a polynomial: P(x)=Coeff(n)xn+Coeff(n1)x(n1)++Coeff(1)x+Coeff(0) at a given value of x. You are to assume that the calling routine first pushes the address of the coefficient array onto the stack, then pushes the degree of the polynomial onto the stack, and then finally passes the value of x onto the stack. The value of P(x) is to be returned in the ax register. The algorithm you should use to evaluate the polynomial should be modeled after the following higher level language code: n= degree; value =Coeff[n]; if (n==0) return; else for (i=n1; i>=0; i-- ) value = value x+Coeff[i]; EvaluatePoly PROC push ebp mov ebp,esp ; Write code here EvaluatePoly ENDP

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions