floating point underflow; exception on attempt to print value less than DBL_MIN

Loren James Rittle rittle@latour.rsch.comm.mot.com
Fri Mar 22 17:33:00 GMT 2002


I wrote:
> I now have a recent enough gdb build for alpha*-*-freebsd*
> thus can debug the last known (to me) showstopping issue:

> ../../gcc/gcjh -classpath '' -bootclasspath . java/lang/Double
> gmake[1]: *** [java/lang/Double.h] Floating point exception (core dumped)

OK, I have now fully debugged the situation. This code in
gcc/java/gjavah.c:
 if (! java_double_finite (dnum))
 fputs (";\n", out);
 else
 fprintf (out, " = %.17g;\n", dnum);
while trying to print out this line of java/lang/Double.h
 static const jdouble MIN_VALUE = <min value [1]>
 [1] however the value printed on i386-*-freebsd4.5 is actually less
 than the system's DBL_MIN. 4.9406564584124654e-324 is printed
 as it should for Java there yet 2.2250738585072034e-308 is the
 published minimum (same as on alpha-*-freebsd*).
underflows and produces the exception within the system's vfprintf
implementation. Under gdb, the value of dnum looks as mandated by
Java: f16 0 (raw 0x0000000000000001)
This program runs fine on both platforms:
#include <float.h>
main() { printf (" = %.17g;\n", DBL_MIN); }
This program displays the difference in action:
#include <float.h>
main() { printf (" = %.17g;\n", DBL_MIN / 10); }
On i386-*-freebsd4.5, this actually prints a value smaller than
DBL_MIN from <float.h> (I'm not surprised):
 = 2.2250738585072034e-309;
On alpha-*-freebsd4.2 and alpha-*-freebsd5.0:
floating point exception--core dumped
Given that a value smaller than DBL_MIN is appearing makes me question
that something else is wrong with this port configuration.
OTOH, tracing back to java/lang/Double.java, I see that 5.0E-324 is
used (and that indeed equals the published information that it must be
equal to Double.longBitsToDouble(0x1L) etc)... Humm...
What sort of patch would be accepted, if any? While sorting out C++
library issues, I have noticed that this ieee math implementation
appears to be configured differently than most other platforms by
default. In conjunction with the exception on overflow/underflow, we
see the additional complications.
Running this one header creation by hand under gdb (manually
overriding the value), allows me to completely finish a build. Thus I
believe this is the last issue to be solved before this port can be
listed as bootstrapping.
Regards,
Loren


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /