[kaffe] ARM Double problems

Helmer Krämer hkraemer at freenet.de
Fri Nov 5 02:42:16 PST 2004

On Fri, 5 Nov 2004 12:03:13 +0200 (EET)
Jari Korva <jpkorva at iki.fi> wrote:


> 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 ?

config/config-hacks.h defines a macro DOUBLE_ORDER_OPPOSITE
which tells kaffe that the word order of doubles is different
from the word order of jlongs (it's used in kaffe/kaffevm/fp.c).
At the moment this macro is always defined when compiling kaffe
for arm. Could you try whether the double problems are solved
when this macro is not defined? If so, we should work out some
preprocessor or configure magic to detect whether that macro
is necessary.


More information about the kaffe mailing list