[erlang-questions] Floating point conversion problem on big endian architecture

Stefan Hudelmaier stefan.hudelmaier@REDACTED
Thu Apr 7 16:09:28 CEST 2011


Hi,

we're cross compiling Erlang/OTP on a x86 PC for ARM. On the resulting 
runtime on ARM we have the following strange problem: Converting float 
to binary seems to work fine, exactly as on x86:

 > B = <<3.2:32/big-float>>.
 > io:format("~w~n", [B]).
<<64,76,204,205>>

But converting back to float from this binary, yields the wrong result 
on ARM:

 > <<R:32/big-float>> = B.
 > R.
-428443648.0

While on x86, it works as expected:

 > <<R:32/big-float>> = B.
 > R.
3.200000047683716

When compiling for ARM, we have set erl_xcomp_bigendian=yes. hipe is 
disabled. We have tried R14A and R14B02.

Please let me know, if there is any more information we need to provide.

Kind regards,
Stefan



-- 
Device Insight GmbH
Stefan Hudelmaier, Dipl. Inf.
Willy-Brandt-Platz 3
D-81829 München

Tel.: 089 45 45 448 - 34
Email: stefan.hudelmaier@REDACTED

http://www.device-insight.com




More information about the erlang-questions mailing list