[erlang-patches] Float endianness in 15B

Lukas Larsson lukas@REDACTED
Wed Jul 11 16:03:12 CEST 2012


Hello!

Sorry for the long delay, we just now got our ARM machines working. 
Unfortunately it does not seem to use PDP endian floats. So I hope that 
it is ok with you to do some more work on your end.

Does the compiler you use set __BYTE_ORDER to __PDP_ENDIAN in endian.h? 
If so could you update the ac function to check that first? If we can 
rely on the define it will make the check work better when cross compiling.

Also it would be great to have a testcase for this, would you mind a 
small testcase to erts/emulator/test/float_SUITE.erl ?

Thanks!
Lukas

On 23/03/12 09:20, Michael Sperber wrote:
> On certain ARM machines, there's a problem with float endianness, which
> has been reported many times before.  Symptons:
>
> io_lib:write(1.0).
> "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005299808824"
>
> The problem is *not* that the ARM is not using IEEE 754, as is inferred
> here:
>
> http://erlang.org/pipermail/erlang-questions/2008-October/039148.html
>
> The ARM uses IEEE 754, but the two 32-bit words in the FP
> representation are swapped wrt. Erlang's assumptions.
>
> The fix to the source code is very simple, but the associated autoconf
> hackery is a bit more extensive.
>
> Such a fix is here:
>
> git fetch git://github.com/bjorng/otp.git double_middle_endian
> https://github.com/mikesperber/otp/compare/double_middle_endian
> https://github.com/mikesperber/otp/compare/double_middle_endian.patch
>
> (This is the first time I'm submitting a fix to Erlang, and I needed our
> resident git ninja to help me set up, so I hope you'll forgive me if I
> did something wrong - let me know.)
>



More information about the erlang-patches mailing list