Question: Evaluate the polynomial: 30x3 - 45x2 + 28x - 15 Get the value for x from symbolic addresses x. Store the result at symbolic address

Evaluate the polynomial: 30x3 - 45x2 + 28x - 15

Get the value for x from symbolic addresses x. Store the result at symbolic address poly. Since load delays are turned on in SPIM be careful what instructions are placed in the load delay slot. Evaluate the polynomial by using Horners Method. This is a way of building up values until the final value is reached. First, pick a register, say $7, to act as an accumulator. The accumulator will hold the value at each step. Use other registers to help build up the value at each step.

First, put the coefficient of the first term into the accumulator: 30

Next, multiply that value by x: 30x Add the coefficient of the next term: 30x 45

Next, multiply that sum by x: 30x2 -45x Add the coefficient of the next term: 30x2 - 45x + 28

Next, multiply that sum by x: 30x3 - 45x2 + 28x Finally, add the coefficient of the last term: 30x3 - 45x2 + 28x - 15

Evaluating the polynomial in this way reduces the number of steps (and the amount of code).

A sample of the data section in your program is shown as below. .

data x: . word10

poly : . word 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!