mongodb - Scientific notation in Elixir -
i pulling data mongodb
{ "id": "123", "name": "foo", "credit": 10000 } for reason when credit float type value of 1.0e4 equal 10000.
how can parse regular display (10000) ?
to convert float integer can use round/1 or trunc/1
iex> round(10000.00) 10000 iex> trunc(10000.00) 10000 to output float integer string, can use :erlang.float_to_binary/2
iex> :erlang.float_to_binary(10000.00, decimals: 0) "10000"
Comments
Post a Comment