For this problem, I want you to perform a floating point addition in
C. By hand: you can't use the float or
double data types, either explicitly or implicitly.
Remember these coding standards apply to this assignment.
"-" sign0 to 9
inclusive. If the leading digit is a 0, it'll be
the only digit.
0 to 9 inclusive.
So here are some examples of valid numbers: 10.0,
-13.125, 0.12500.
And here are some examples of invalid numbers: 01.125
(leading 0 isn't the only digit to the left of the decimal point),
+12.375 (leading + sign), .375 (no digit
before decimal point), -1. (no digit after decimal
point), 2 (no decimal point).
So, an example of a valid invocation of this program is
% add 1.375 -2.0
Note that the inputs have to be on the command line: do not prompt for them, do not read them from standard input.
You don't need to check the input: we will only give your program inputs corresponding to these specifications.
Your program should do the following:
strtoul or other system
functions). Since the computer works in binary, you'll need to
use the multiplication method to convert the integer part and
the division method to convert the fraction part. Print
the IEEE representations to standard out.
% add 1.375 -2.0 3fb00000 c0000000 bf200000