float_to_list(X)

Scott Ribe scott_ribe@REDACTED
Fri May 7 14:37:44 CEST 2021


> On May 7, 2021, at 6:00 AM, Eckard Brauer <eckard.brauer@REDACTED> wrote:
> 
> 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.

This is not necessary. If float_to_list is meant to transfer values between machines, then it should use the appropriate algorithms and return enough digits to exactly recover the value. Whether it does or does not do that now should probably be documented. If it does not, then perhaps it should be changed, or an option added.


More information about the erlang-questions mailing list