Question: 1) You will develop a library module of C functions which operate on floating point values using only integer operations. The library module will include

1) You will develop a library module of C functions which operate on floating point values using only integer operations. The library module will include the functions listed below:

float get_infinity(); /* Return infinity */

float get_nan(); /* Return not-a-number */

float get_max_normal(); /* Return largest normal */

float get_min_normal(); /* Return smallest normal */

float get_max_denormal(); /* Return largest denormal */

float get_min_denormal(); /* Return smallest denormal */

int is_negative( float ); /* Test if argument is negative */

int is_infinity( float ); /* Test if argument is infinity */

int is_nan( float ); /* Test if argument is not-a-number */

int is_zero( float ); /* Test if argument is zero */

int is_denormal( float ); /* Test if argument is denormal */

float negate( float ); /* Return negation of argument */

float absolute( float ); /* Return absolute value of argument */

The first six functions will return the specified single-precision value (all will be positive). The return value from function get_nan will have a fraction field where each of the bits is a 1. The next five functions will return 0 if the specified condition is false, and 1 if the condition is true. Functions negate and absolute will perform the appropriate operation on the argument and return the result.

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!