[erlang-questions] float number rounded/truncated

Gamoto <>
Fri Apr 24 17:32:17 CEST 2009


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 ?







More information about the erlang-questions mailing list