From Computer Systems: a Programmer's Perspective:
With single-precision ﬂoating point
(3.14+1e10)-1e10evaluates to 0.0: the value 3.14 is lost due to rounding.
(1e20*1e20)*1e-20evaluates to +∞ , while
1e20*(1e20*1e-20)evaluates to 1e20.
How can I detect lost of precision due to rounding in both floating point addition and multiplication? (in C or Python)
What is the relation and difference between underflow and the problem that I described? Is underflow only a special case of lost of precision due to rounding, where a result is rounded to zero?