[erlang-questions] float number rounded/truncated

Ulf Wiger ulf@REDACTED
Fri Apr 24 19:08:42 CEST 2009


How about

1> io_lib:fwrite("~f", [list_to_float("1234.5678")/100]).
["12.345678"]

BR,
Ulf W

2009/4/24 Gamoto <gamoto@REDACTED>:
> I have the string representation of a float number: "1234.5678"
> I want to transform like this: "12.345678"
> I do: N1 = list_to_float(Number)/100, N2 = float_to_list(N1)
> But the result is:   "1.2345678000....e+001"
>
> My method is bad ;-(
> How to round or trunc a float number in Erlang and to not have a EEE representation ?
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list