[Bug libgcj/26483] Wrong parsing of doubles when interpreted

wilson at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Feb 28 03:30:00 GMT 2006



------- Comment #4 from wilson at gcc dot gnu dot org  2006-02-28 03:25 -------
The number 5e-324 exceeds the range of the (C language) double type.  So the
result you get will depend on how overflow is handled.  If I use a number
within the range of double, it works fine.  I don't know what Java is supposed
to do in the presence of overflow here.

Compile this with -E
#include <float.h>
DBL_MIN_10_EXP
and we get a result of -307.  So 5e-324 is an out-of-range number.

The number is within range of an IA-64/x86 80-bit FP long double number. 
LDBL_MIN_10_EXP is -4931.  So if long doubles are being used, intentionally or
accidentally, this could work.

On an x86_64 system, I get an answer of 0.0 for both the compiled and
interpreted tests.  If I use -m32 when compiling, I get the answer "5E-324".  I
don't have a 32-bit compiled interpreter, so I can't check that.

Without access to a copy of the Java standard, it isn't clear to me what the
correct answer is here.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26483



More information about the Gcc-bugs mailing list