Tools needed: editor of your choice
C programming language
Concepts needed: IEEE Floating point representation
round to even
round toward zero
The following bit-level floating-point coding rules should be used when implementing the functions for this Project:
1. Your code should replicate the conventions for IEEE floating-point operations, including using round-to-even mode when rounding is required.
2. The data type float_bits is defined to be equivalent to unsigned:
/* access bit-level representation floating-point number *.
typedef unsigned float_bits;
3. Instead of using data type float in your code, you will use float_bits. Your are allowed to use standard control structures (selection, loops) and you may use both int and unsigned data types, including unsigned and integer constants and operations. You may not use any unions, structs, or arrays. You may not use any floating-point data types, operations, or constants. Any floating-point value will be of type float_bits, and any returned floating-point value will be of type float_bits. Your code should perform the bit manipulations that implement the specified floating-point operations.
Problem Statement: Following the bit-level floating-point coding rules given above, you are to implement the following single-precision floating-point operations:
float_bits float_abs(float_bits f); - this functions computes the absolute value of f. If f is NaN, your function should return f.
float_bits float_twice(float_bits f); - this function computes 2 * f. If f is NaN, your function should return f.
float_bits float_i2f(int i); - this functions computes the bit-level representation of (float) i.
int float_f2i(float_bits f); - this functions computes (int) f. Your function should round toward zero. If f cannot be represented as an integer (e.g., it is out of range, or it is NaN, then the function should return 0x80000000.
-Test each function by evaluating it for given values of the argument and comparing the result to what would be obtained using the CS machine's floating-point operations.
7 freelancer bu iş için ortalamada 46$ teklif veriyor
Hello, I'm a native English speaker with extensive technical experience. I have a degree in Comp Sci and have worked in the industry on lots of C projects. I can get it done in a day or two max.
Hello sir. I am interested for this job. I have great experience with c/c++ programming. If you want serious man who can start right now, then I am perfect choice. Regards vladang