So I am a bit helpless. I think I understand how to do an addition on IEEE-754 numbers, but I have big problems with subtraction. I have the feeling, that my thoughts are correct, but I want to verify with you guys.
So we have the following two IEEE-754 numbers:
x: 0 1000 0010 100 1000 0000 0000 0000 0000
y: 0 1000 0011 010 1001 0000 0000 0000 0000
Since we have to positive numbers and we want to subtract them, my idea was to take y, invert the mantissa and calculate
x+(-y)
A tutor told me, that that's incorrect, and I have to keep the numbers positive and just subtract them. Why and how he did not tell me.
Can somebody tell me what is the right way to do this?
My thoughts for doing it the x-y way:
- extend the exponent from x to 1000 0011
- shift the mantissa of x by 1
- subtract the two numbers the normal way