[erlang-bugs] Math library defect?

Matthew Dempsky matthew@REDACTED
Thu May 15 18:57:42 CEST 2008


2008/5/15 John Haugeland <stonecypher@REDACTED>:
> I believe I have found a defect in the math library.
>
> 24> io:format("~f",[math:pow(2,56)]).
> 72057594037927936.000000ok
>
> 25> io:format("~f",[math:pow(2,57)]).
> 144115188075855870.000000ok
>
> 26> 72057594037927936 * 2.
> 144115188075855872
>
> You'll notice that the value given by step 25 is incorrect by two.

What version of OTP and what operating system are you using?

It works fine for me with R12B-1 on OS X 10.5:

5> io:format("~f ~f.~n", [math:pow(2, 56), math:pow(2, 57)]).
72057594037927936.000000 144115188075855872.000000.



More information about the erlang-bugs mailing list