[erlang-questions] Re: Floating point conversion problem on big endian architecture
Mikael Pettersson
mikpe@REDACTED
Thu Apr 7 18:31:58 CEST 2011
Stefan Hudelmaier writes:
> 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.
What's the target platform? OABI or EABI? v5? v7? Thumb? Linux? gcc version?
Hard or soft FP?
Floating-point on OABI with its default FPA format is horribly broken by
design and won't work (I've forgotten if it's big or little endian that
breaks). Don't go there.
EABI should work.
More information about the erlang-questions
mailing list