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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started