diff options
Diffstat (limited to 'src/gleam_stdlib.erl')
-rw-r--r-- | src/gleam_stdlib.erl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gleam_stdlib.erl b/src/gleam_stdlib.erl index 6fd44ed..320d80b 100644 --- a/src/gleam_stdlib.erl +++ b/src/gleam_stdlib.erl @@ -10,7 +10,7 @@ percent_encode/1, percent_decode/1, regex_check/2, regex_split/2, base_decode64/1, parse_query/1, bit_string_concat/1, size_of_tuple/1, decode_tuple/1, tuple_get/2, classify_dynamic/1, print/1, println/1, - inspect/1]). + inspect/1, float_to_string/1]). %% Taken from OTP's uri_string module -define(DEC2HEX(X), @@ -374,4 +374,7 @@ inspect(Any) when is_function(Any) -> ), ["//fn(", Args, ") { ... }"]; inspect(Any) -> - ["//erl(", io_lib:format("~p", [Any]), ")"].
\ No newline at end of file + ["//erl(", io_lib:format("~p", [Any]), ")"]. + +float_to_string(Float) when is_float(Float) -> + erlang:iolist_to_binary(io_lib_format:fwrite_g(Float)). |