Solved-Lab 8- Fixed Point Math- Solution

$35.00 $24.00

  For this lab, you will work with fixed point numbers. You will link your assembly code with C functions that help with input and output of fixed-point numbers.   8.1  Assignment   Below, you will find two C functions, strtofixed and print_U along with a helper function base10double. Note that you will have to…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

 

For this lab, you will work with fixed point numbers. You will link your assembly code with C functions that help with input and output of fixed-point numbers.

 

8.1  Assignment

 

Below, you will find two C functions, strtofixed and print_U along with a helper function base10double. Note that you will have to modify them slightly to deal with signed numbers. You may type those functions as shown and use them in your program. You are to create a table for the function f (x), where

x3 ¡ x2 ¡2x

f (x) ˘

(x¡112)4 ¯3

 

Your fixed-point numbers should have a minimum of 16 bits in the fractional part during all phases of calculation.

 

8.2  Instructions

 

  1. Output a brief descriptive message telling the user that the program will create a table for

f (x) ˘ x3¡x2¡2x .

(x¡112)4 ¯3

 

  1. Prompt the user and read a value for the lower limit of x. This will be the value of x for the first row in the table.

 

  1. Prompt the user and read a value for the upper limit of x. This will be the value of x for the last row in the table.

 

  1. Prompt the user and read a value for the number of rows they want in the table.

 

  1. Generate a table with two columns. Show x in the first column, and f (x) in the second column.

 

  1. BONUS: Modify print_U so that it as a third parameter to specify how many digits to show after the decimal point. Print the table with 4 digits to the right of the decimal point on every number.

 

  1. BONUS: Allow the user to specify how many bits of fractional precision should be used in the calculations.