[kaffe] MIN_VALUE of java.lang.Double
Ito Kazumitsu
ito.kazumitsu at hitachi-cable.co.jp
Wed Oct 9 18:42:47 PDT 2002
In message "Re: [kaffe] MIN_VALUE of java.lang.Double"
on 02/10/09, "Kevin D. Kissell" <kevink at mips.com> writes:
> I don't have the revised Java Language Specification handy to
> see of they fixed it. In any case, I believe that kaffe should be using
> the value that corresponds to the true minimum denormalized IEEE
> double.
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#230798
reads:
The smallest positive finite nonzero literal of type double is
4.94065645841246544e-324.
A compile-time error occurs if a nonzero floating-point literal is
too small, so that, on rounded conversion to its internal representation,
it becomes a zero.
So I understand 4.94065645841246544e-324 should be used, but the
problem is that a compile-time error occurs where some poor strtod
converts 4.94065645841246544e-324 to zero.
Formerly, precompiled Klasses.jar was included in the kaffe package
so I did not have to compile java/lang/Double.java. But now we
have to make rt.jar ourselves. So the compile-time error that
java/lang/Double.java causes is really annoying.
This is how strtod of my machine works:
$ uname -smr
Linux 2.0.38 i686
$ cat Double.c
#include <stdlib.h>
extern int errno;
int main(int argc, char* argv[]) {
double d = strtod(argv[1], NULL);
printf("%s %d %40.20e\n",argv[1], errno, d);
}
$ cc -o Double Double.c
$ ./Double 4.94065645841246544e-324
4.94065645841246544e-324 0 0.00000000000000000000e+00
$ ./Double 4.9e-324
4.9e-324 0 0.00000000000000000000e+00
$ ./Double 5e-324
5e-324 0 4.94065645841246544177e-324
More information about the kaffe
mailing list