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 18:07:00 GMT 2002


In article <87y9gkqb44.fsf@creche.redhat.com>,
Tom Tromey <tromey@redhat.com> writes:
> I assume that DBL_MIN is the minimum normal number, and the Java
> Double.MIN_VALUE is denormalized.

OK. I know the terms but should the libc routine always be able to
print the denormalized values? I now question my earlier thought that
it was an underflow problem.
Loren> Given that a value smaller than DBL_MIN is appearing makes me
Loren> question that something else is wrong with this port
Loren> configuration.
> Not necessarily.

OK.
Loren> What sort of patch would be accepted, if any? While sorting
Loren> out C++ library issues, I have noticed that this ieee math
Loren> implementation appears to be configured differently than most
Loren> other platforms by default. In conjunction with the exception
Loren> on overflow/underflow, we see the additional complications.
> It sounds like libgcj might see these floating point exceptions at
> runtime, which we definitely don't want. Is there something we can
> call at runtime to tell the system not to generate these?

> If there is, then libgcj ought to call it. So should gcjh.
> This will no doubt require configure hacking.

> If you can find such a call, modify your test program to use it and
> then see what happens.

> Failing that, I suppose we could link gcjh against something like
> fdlibm. That might be painful. And it won't solve potential problems
> in libgcj.

OK, I will try this and report back (on Monday).
> If you have other ideas, feel free...

I will need to look at exactly why the libc routine is raising an
exception (unfortunately, I don't have libc built for debugging on
these alpha machines at the moment). I might have found a real OS
bug.
Does the output of this program:
#include <float.h>
main() {
 double d = DBL_MIN;
 printf (" = %.17g;\n", d);
 printf (" = %.17g;\n", d/10);
 printf (" = %.17g;\n", (DBL_MIN/10)*10);
 printf (" = %.17g;\n", (DBL_MIN/10));
}
S rittle@clerc-milon; a.out
 = 2.2250738585072014e-308;
 = 0;
 = 2.2250738585072034e-308;
floating point exception--core dumped
make any sense? Not to me.


More information about the Java mailing list

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