Floating Point Implementation Implement a program in C to perform “home made” fl

WRITE MY ESSAY

Floating Point Implementation
Implement a program in C to perform “home made” floating point functionality using only integer
operations.
Many simple machines do not support floating point arithmetic in hardware or in software. In
these situations, if you need this capability then you must implement it yourself. Someday you
may find yourself being tasked with implementing floating point operations in hardware for some
new hardware device, or in software for some new complier language or other software tool. You
might find yourself stranded on a deserted island and need to build a computer out of coconuts,
such a computer would certainly need floating point operations. This happened on Gilligan’s
Island at least once (reference needed).
Requirements:
Download the “floats.cpp” template from my website. Complete and thoroughly test the
functions declared in the template.
0) Implement and test floating point addition using the specified 8-bit representation.
unsigned char addFloats(unsigned char f1, unsigned char f2)
1) Implement and test floating point multiplication using the specified 8-bit representation.
unsigned char multiplyFloats(unsigned char f1, unsigned char f2);
2) Using the given bit format, print every possible positive base ten floating point value.
Because we are using 8 bits, there will be 28 = 256 possible values. The easiest way to
generate these values is to count on the char (f++) from 0 to 255. Use Excel to sort and plot
the float values on a number line similar to that shown below. Comment on the distribution
of numbers. You can cut and paste from the console to Excel. Excel wants XY values to
plot, so use a column of zeros for Y’s to get a number line. Should look something like this…
but slightly different of course to prove you actually did it.
Testing:
Thoroughly test with a variety of input values to demonstrate that your program works. Print out
the intermediate binary representations to prove that it works.
Turn In:
Your addfloats, multiplyfloats, main with testing code, console output, n

WRITE MY ESSAY

Leave a Comment

Scroll to Top