diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f29d1a..74ab07fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ print NaN and Infinity. - The performance of the `to_string` function from the `float` module has been improved on the Erlang target. +- The performance of the `inspect` function from the `string` module for floats + has been improved on the Erlang target. ## v1.0.5 - 2026-08-06 diff --git a/src/gleam_stdlib.erl b/src/gleam_stdlib.erl index 52b8f622..5169e555 100644 --- a/src/gleam_stdlib.erl +++ b/src/gleam_stdlib.erl @@ -285,7 +285,7 @@ inspect(Atom) when is_atom(Atom) -> inspect(Any) when is_integer(Any) -> erlang:integer_to_list(Any); inspect(Any) when is_float(Any) -> - io_lib_format:fwrite_g(Any); + erlang:float_to_binary(Any, [short]); inspect(Binary) when is_binary(Binary) -> case inspect_maybe_utf8_string(Binary, <<>>) of {ok, InspectedUtf8String} -> InspectedUtf8String;