[kaffe] more on float_min and underflow
zuse at libero.it
Tue Jul 13 12:30:17 PDT 2004
I did a careful study of the minimum and maximum value.
I studied the limits.h of several machines, including sparc and mips.
Those always have a minimum of approx. 1/2 e-38 which is very reasonable,
read further below.
I then studied:
and referenced for Java:
as well as
and as a final stage I studied the Motorola 68040 manual, being the 68k
fpu one of the de-facto standard that led to the making of IEE 754
together with intel 8087.
Page 9-8, table 9-3 is very explicit
for single precision real format, the approximate ranges are:
Maximum positive Normalized: 3.4 10^38
Minimum positive Normalized: 1.2 10^-38
Minimum positive Denormalized: 1.4 10^-45
So the conclusion is: standard wisdom and usage on most unix system and
processors and so the standard libraries on them and common C use define
the limits with the NORMALIZED numbers.
Java spec defines the minimum as a Denormalized number.
On one side that is what I temporarily did on IRIX/MIPS: I just
substituted the constant. I seem to have gotten an improvment but I will
conduct further tests.
On the long run however I want to see a more general solution which I
see as difficult since the libraries use different assumptions than Java.
One "half way solution" would be to use one or the other constants
depending on a flag if the constant is "troublesome" or not on some
platforms. Maybe this could be checked by autoconf.
I tried some experiments with atof and strtod but for now I failed to
get some useful result.
More information about the kaffe