Adding 2 IEEE 754 numbers please help

I am trying to learn about IEEE 754 operations, starting with addition. I want to make a code for them but am trying to understand the logic behind them first. The videos I am finding online are not helpful, because I am not sure what to do in this specific case. Can you please help me solve this and show me how you got to the sum of these two numbers?

Add N1 + N2
Sign Exponent Significand (Mantissa?)
_______________________________________
N1 = 0 | 11001111 | 110100000 ..... 0 |
______________________________________|
N2 = 1 | 11011101 | 101100000 ..... 0 |
______________________________________|

Now I know about prepending the decimal to make the numbers under the significant become:
1.110100000 ..... 0
1.101100000 ..... 0
and that the base2 of the exponents comes out to
11001111 = 207
11011101 = 205
Subtracting 207 - 205 = 2, so does this mean I shift left 2? I don't know what to do at this point, please help me solve this.
Last edited on
you subtract 127 from the exponent if this is 32 bit.
and adding up mantissa is 1.0 + 1/2 + 1/4 + 1/8 + 1/16 ... (for the set bits, skip the 0s of course)

I would start by using doubles to make the numbers by hand. That is, take a number you know what it is, get the sign bit, get the exponent, get the mantissa (as a double). Multiply mantissa * exponent term (2 to the exponent) * sign and see if you get your value back.
from there you can see what is going on and start fooling with it bit-wise. Also note that endian can apply to floating too, so watch which byte is where.
you may want to make a little object that has the float value, a byte (char* cast) array of the value, and a bitset of the byte-array of the value.
do simple stuff at first, like 10*5. whatever you have has 2^80 exponent (??) ...
Last edited on
Topic archived. No new replies allowed.