Programming Lab #8a Fixed vs. Floating Point solved

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (8 votes)

Background: Taylor series are often used as approximations for exponential functions,
logarithmic functions, and trig functions. Each such approximation is simply a polynomial in
which the coefficients (𝑎0, 𝑎1, 𝑎2, ⋯) have been determined according to the function desired.
𝑎0𝑥
0 + 𝑎1𝑥
1 + 𝑎2𝑥
2 + ⋯ + 𝑎𝑛−1𝑥
𝑛−1
When implemented in a computer program, the values of 𝑥, the coefficients and the polynomial
must be implemented as reals (not integers). However, the computation can use constants,
variables and arithmetic based on either a floating-point or fixed-point representation of reals.
Assignment: You are to create a single assembly language file containing two functions – one
called FloatPoly that evaluates a polynomial using single-precision 32-bit floating-point reals
and a second called FixedPoly that evaluates a polynomial using 32-bit Q16 fixed-point reals:
float FloatPoly(float x, float a[], int32_t n) ;
Q16 FixedPoly(Q16 x, Q16 a[], int32_t n) ;
Test your functions using the C main
program downloaded from here. The program will call
each function with an array 𝑎 containing 𝑛 coefficients
that have been chosen to approximate the sine function at
an angle 𝑥 expressed in radians. The values returned by
the two functions are used to display two sine waves for
comparison. If your code is correct, the display should
look like the image to the right although it will be
animated and your cycle counts may differ.
Error messages (if any) will appear as white text on a red
background.