So in class, we were talking about the idea of floating point precision in IEEE754 format, and how, when some numbers are added, precision is lost. My professor then gave the following example of a large absolute error between what we think the answer might be, and what the answer actually is when our program (written in Java) actually compiles it:
$0.4 \times10^{30} + 1.1 \times10^{30}$
Compiling this in Java, i get $1.5000001 \times 10^{30}$
My question is, why does this happen? Printing out the IEEE754 format of the two numbers, I get:
$\space\space\space0[11100010]10111100010010010101011=+1.10111100010010010101011\times2^{99}$ $+0[11100001]01000011000111100001000=+1.01000011000111100001000\times2^{98}$
So, I suppose when you add these, you end up loosing precision, but exactly how? Moreover, how can I even tell, before adding, that the addition of two numbers will make them loose precision? Or is the only way to just plus into a program and see what happens? None of this was really covered in class unfortunately.