[erlang-patches] Float endianness in 15B
Michael Sperber
sperber@REDACTED
Fri Mar 23 09:20:27 CET 2012
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.)
--
Regards,
Mike
More information about the erlang-patches
mailing list