[kaffe] ARM Double problems

Jari Korva jpkorva at iki.fi
Fri Nov 5 02:03:13 PST 2004


Hi,

I observed some floating point problems on double data type on my armv5b
box (float works just fine though). The problem seems to be a
double/floating point endianness issue.

For example this code: System.out.println(0.2);
Outputs: -2.3534382788928255E-185

I looked at the problem more carefully and found out that on a C-program
(compiled with -Wlong-long -fsigned-char) 0.2 is stored as follows:

3fffffffc9ffffff99ffffff99ffffff99ffffff99ffffff99ffffff9a

While it looks like this on Kaffe/intrp
(printed from java_lang_Float_toStringWithPrecision):

ffffff99ffffff99ffffff99ffffff9a3fffffffc9ffffff99ffffff99

Is this possibly the same/similar problem with floating point formats,
that I observed previously on gcj on armvl5: http://gcc.gnu.org/PR16132 ?


Here's my test code:

    int i;
    char *ptr = (char *)&val;

    printf("%lf\n", f);
    for(i=0; i < sizeof(jdouble); i++)
        printf("%2x", ptr[i]);
    printf("\n");

and Kaffe configuration:

./configure CFLAGS=-I/opt/cross/armv5b-linux/include
--build=i686-linux --host=armv5b-softfloat-linux --enable-xscale
--without-x --disable-alsatest --disable-esdtest --disable-sound
--enable-pure-java-math
 --with-jikes=/opt/local/bin/jikes --without-classpath-gtk-awt
--without-kaffe-qt-awt --without-kaffe-x-awt --with-threads=unix-pthreads
--with-engine=intrp --with-staticbin --enable-debug --enable-xdebugging

Cheers,
  Jari





More information about the kaffe mailing list