On Thu, Sep 21, 2017 at 9:20 PM, Nick Coghlan <ncogh...@gmail.com> wrote:
> >>> one_tenth = 0x1.0 / 0xA.0 > >>> two_tenths = 0x2.0 / 0xA.0 > >>> three_tenths = 0x3.0 / 0xA.0 > >>> three_tenths == one_tenth + two_tenths > False > OMG Regardless of whether we introduce this feature, .hex() is the way to show what's going on here: >>> 0.1.hex() '0x1.999999999999ap-4' >>> 0.2.hex() '0x1.999999999999ap-3' >>> 0.3.hex() '0x1.3333333333333p-2' >>> (0.1+0.2).hex() '0x1.3333333333334p-2' >>> This shows so clearly that there's 1 bit difference! -- --Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/