[kaffe] more on float_min and underflow
Riccardo
zuse at libero.it
Tue Jul 13 12:30:17 PDT 2004
Hello
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:
http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
and referenced for Java:
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#
230798
as well as
http://www.ce.utwente.nl/javapp/information/CTJ/ctj-doc/constant-values.
html
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.
-Riccardo
More information about the kaffe
mailing list