[kaffe] Re: The problem of "Double.c and buggy strtod" is settled

Ito Kazumitsu kaz at maczuka.gcd.org
Thu Jun 5 08:57:01 PDT 2003


>>>>> "*" == Ito Kazumitsu <kaz at maczuka.gcd.org> writes:

*> In fact, FreeBSD 4.7-RELEASE's /usr/include/float.h says
*> #define DBL_MIN         2.2250738585072014E-308
*> and replace/strtod.c says, when HAVE_FLOAT_H is undefined,
*> almost the same thing:
*> # define DBL_MIN 2.2250738585072010e-308
*> I remember Linux 2.0.x's float.h also defines something like this.
*> 
*> So Java's double MIN_VALUE 4.9406564584124654418e-324 will be
*> considered to be 0.0 by this strtod.c.

Studying this issue further,  I found that DBL_MIN is not the only
factor that makes strtod convert 4.9406564584124654418e-324 to 0.0.

Even if I comment out 
       if (num < DBL_MIN * pow (10.0, (double) -exponent))
        goto underflow;
this strtod converts 4.9406564584124654418e-324 to 0.0 although
errno is not set.

Inserting "printf("## num, exp = %f, %d\n", num, exponent);"
before "num *= pow (10.0, (double) exponent);",  I get
"## num, exp = 49406564584124661760.000000, -343".  So
the reason why 4.9406564584124654418e-324 becomes 0.0
seems to be the limitation of the function pow().




More information about the kaffe mailing list