round / trunc

Per Gustafsson per.gustafsson@REDACTED
Tue Oct 5 15:54:00 CEST 2004


It is floating point multiply so 4> is not particularily surprising since
you get the following result when you multiply 9993.38 with 100

1> io:format("~.16f",[9993.38*100]).
999337.9999999998835850

Per

On Tue, 5 Oct 2004, Danie Schutte wrote:

> Strange scenario:
> 2 and 3 are correct but 4 is obviously wrong - any ideas as to why the
> precision is so accurate?
>
> 2> round(list_to_float("9993.38")*100).
> 999338
> 3> trunc(list_to_float("9993.39")*100).
> 999339
> 4> trunc(list_to_float("9993.38")*100).
> 999337
>
>
>
>
>



More information about the erlang-questions mailing list