[issue3008] Let bin() show floats

Antoine Pitrou report at bugs.python.org
Fri May 30 20:27:48 CEST 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

> I read the proposal as
> producing the true mathematical radix 2 representation of a float
> rather than its 64-bit memory layout.

The term "layout" was probably badly chosen.
Still, the explicit motivation for producing that representation is that
it it supposed to educate people about the actual implementation of
floats. Other than that, a radix 2 representation is quite an obscure
(and almost never used) way of representing float objects. Binary
representation of integers in comparison is more widely understood and
more frequently used, which -- I suppose -- justifies the existence of a
builtin function to obtain it.

> I fail to see how the proposed bin(..) can produce '0b11.00100..' from
> a float that compares equal to 3.

Oops, you are right. bin(3.0) would produce '0b11.', which is indeed
more readable.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3008>
_______________________________________


More information about the Python-bugs-list mailing list