Hi,
I am playing around the math function that’s inherited from Erlang and when I run the command
:math.sqrt(1722250000)
I get the answer in exponential form as
4.15e4
How can I get a plain answer that is
41500
Hi,
I am playing around the math function that’s inherited from Erlang and when I run the command
:math.sqrt(1722250000)
I get the answer in exponential form as
4.15e4
How can I get a plain answer that is
41500
These are the same thing, just displayed differently. So if you want to display it in “regular” notation, then you can format it using :io_lib.format/2
. Alternatively if you are sure it will be integer, then you can use trunc/1
to make it into integer.
If that’s not a deal breaker, you can use the Elixir library Decimal
.