2017-09-12 3:48 GMT+02:00 Steven D'Aprano <st...@pearwood.info>:
>> k = float("0x1.2492492492492p-3") # 1/7
>
> Why wouldn't you just write 1/7?

1/7 is irrational, so it's not easy to get the "exact value" for a
64-bit IEEE 754 double float.

I chose it because it's easy to write. Maybe math.pi is a better example :-)

>>> math.pi.hex()
'0x1.921fb54442d18p+1'

Victor
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to