[erlang-questions] display floats without -e?

Dmytro Lytovchenko dmytro.lytovchenko@REDACTED
Mon Dec 31 19:11:58 CET 2018


A quick answer without much thinking
You can avoid this by specifying precision, i.e.

io_lib:format("~.6f",[F]).


On Mon, 31 Dec 2018 at 17:37, Vans S <vans_163@REDACTED> wrote:

> 1> 0.0001.
> 0.0001
> 2> 0.00001.
> 1.0e-5
>
> Once floats get to the 4th/5th decimal place they start being displayed
> with the e-x notation.  Is there a way to make them always display
> "normally", for example 0.00001 in this case.  The problem is when you turn
> the float into a string, its also displayed as 1.0e-5, adding a format
> function works yes, but gets annoying to maintain when you need to do
> arithmetic on the floats.  LIke sorting by the value.
>
> Also debugging becomes annoying when you see the e-5, e-6, etc notation
> everywhere and have to match it up.
>
> Is there a way to compile / add arg to the VM to not do this?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181231/58a23452/attachment.htm>


More information about the erlang-questions mailing list