On Mon, Feb 07, 2022 at 05:35:17PM -0800, Gregory P. Smith wrote:

> CPython: yes.  we use a double.
> Python the language: no.  (float is single precision on many micropython
> platforms as it saves precious ram and performance, plus microcontroller
> fpu hardware like an M4 is usually single precision 32bit)

If we are to *officially* support non-double floats, it would be nice if 
sys.float_info were to tell us explicitly how wide the floats are rather 
than having to try to reverse engineer it from the other information 
there.

A floating point expert can probably look at this:

sys.float_info(max=1.7976931348623157e+308, max_exp=1024, 
max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, 
min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, 
radix=2, rounds=1)

and immediately recognise that those values imply a 64-bit float, but I 
expect most people will not. If Python the language is going to support 
single, double, quad precision floats, and maybe even minifloats with 
just 16 or even fewer bits, then can we please add a field to float_info 
telling us how many bits the floats have?


-- 
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EUWN4TDI62FK7L6SOG6IAV3AOINDBH6O/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to