float_to_list(X)

Eckard Brauer eckard.brauer@REDACTED
Fri May 7 14:00:57 CEST 2021


For that purpose it makes maybe more sense to show a sort of "hybrid"
representation of the form floats are usually represented in memory:

s 1.mmmm e xxxx

where

s    is signum ("-", "+" or empty),
mmmm    is mantissa, in hex, oct or bin to effectively express all
relevant digit positions (with removed trailing zeroes),
xxxx    is exponent with possible "-" and also all digits needed.

That would be both human readable and provide some metric, while still
keeping some compactness (maybe not really true for the binary form)
and unambiguousness.

Just my 2 cents.

E.

Am Fri, 7 May 2021 22:26:39 +1200
schrieb "Richard O'Keefe" <raoknz@REDACTED>:

> Two different floats, no matter how small the difference,
> should result in different lists.  It's meant for converting a float
> to text that you can send to another machine and reconstitute the
> same value there.



More information about the erlang-questions mailing list