<div dir="ltr">my shell output is:<br><br>4> <<1.0:64/float>>.<br><<0,0,0,0,63,240,0,0>><br><br><br>as Tony said, S3C2410/ARM920T CPU , double float is "<font color="#000000">Middle Endian</font>"<br>
<br>IEEE float:  12 34 AB CD<br>Middle Endian: AB CD 12 34<br><br><br>my toolchain doesn't support "-msoft-float" option.<br>
[root@LH01 ~]# arm-unknown-linux-gnu-readelf -h /tmp/cross-compile/lib/erlang/erts-5.6.4/bin/beam<br>ELF Header:<br>  Magic:   7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00 <br>  Class:                             ELF32<br>
  Data:                              2's complement, little endian<br>  Version:                           1 (current)<br>  OS/ABI:                            ARM<br>  ABI Version:                       0<br>  Type:                              EXEC (Executable file)<br>
  Machine:                           ARM<br>  Version:                           0x1<br>  Entry point address:               0x21f84<br>  Start of program headers:          52 (bytes into file)<br>  Start of section headers:          1346104 (bytes into file)<br>
  Flags:                             0x2, has entry point, GNU EABI<br>  Size of this header:               52 (bytes)<br>  Size of program headers:           32 (bytes)<br>  Number of program headers:         6<br>  Size of section headers:           40 (bytes)<br>
  Number of section headers:         31<br>  Section header string table index: 28<br><br><br>My platform doesn't support clock_gettime(CLOCK_MONOTONIC,&ts) , /erts/emulator/sys/unix/sys.c, so I can't use debian binary.<br>
<br><br><br><div class="gmail_quote">2008/10/15 Bob Ippolito <span dir="ltr"><<a href="mailto:bob@redivi.com">bob@redivi.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
There's code in io_lib_format.erl that does the default format floats,<br>
which assumes IEEE 754 floats. Perhaps the float<->binary code is<br>
broken on your platform, or your platform doesn't do IEEE 754?<br>
<br>
This is the code in io_lib_format (in R12B3 anyway, I don't have R12B4<br>
installed on this machine):<br>
<br>
mantissa_exponent(F) -><br>
    case <<F:64/float>> of<br>
        <<_S:1, 0:11, M:52>> -> % denormalized<br>
            E = log2floor(M),<br>
            {M bsl (53 - E), E - 52 - 1075};<br>
        <<_S:1, BE:11, M:52>> when BE < 2047 -><br>
            {M + ?BIG_POW, BE - 1075}<br>
    end.<br>
<br>
Does the output for this differ in your shell? If so, then your Erlang<br>
VM isn't doing the right thing when converting floats to binary...<br>
<br>
1> <<1.0:64/float>>.<br>
<<63,240,0,0,0,0,0,0>><br>
<br>
<br>
2008/10/15 WS Dao <<a href="mailto:chn.dao77@gmail.com">chn.dao77@gmail.com</a>>:<br>
<div><div></div><div class="Wj3C7c">> I cross-compiled OTP R12B4 for my ARM9 platform (S3C2410, kernel 2.4.18)<br>
> When I run erl on arm, float error occurs:<br>
> # ./erl<br>
> Eshell V5.6.4  (abort with ^G)<br>
> 1> 3+5.<br>
> 8<br>
> 2> 3.0.<br>
> 0.<br>
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005307579804<br>

> 3> 3.0+4.0.<br>
> 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000531405562<br>

> 4><br>
><br>
> My toolchain is gcc <a href="http://3.4.5." target="_blank">3.4.5.</a>  I'd wrote a c test program and cross-compile it,<br>
> no float problems found.<br>
><br>
> Any suggestion?<br>
><br>
><br>
> -dao<br>
</div></div>> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
</blockquote></div><br></div>