Discussion about Java Floating Point?

Martin Desruisseaux martin.desruisseaux at geomatys.com
Tue Mar 15 10:38:08 UTC 2022


Hello A.Z.

As Raffaello said, Java arithmetic does not have any more problem than 
C/C++ when using IEEE 754. The "proof" of contrary is only an illusion 
due to the rounding behavior of C/C++ output routines, as demonstrated 
by Raffaello's code. Maybe some C/C++ code use Intel extended precision 
arithmetic (80 bits instead of 64 bits), but it only pushes the problem 
further, it still not an exact representation of decimal numbers. Exact 
representation of 0.1 using base 2 is mathematically impossible, no 
matter the language (it is a periodic number in base 2).

     Regards,

         Martin




More information about the core-libs-dev mailing list