<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 21, 2017 at 9:20 PM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    >>> one_tenth = 0x1.0 / 0xA.0<br>
    >>> two_tenths = 0x2.0 / 0xA.0<br>
    >>> three_tenths = 0x3.0 / 0xA.0<br>
    >>> three_tenths == one_tenth + two_tenths<br>
    False<br></blockquote><div><br></div><div>OMG Regardless of whether we introduce this feature, .hex() is the way to show what's going on here:</div><div><br>>>> 0.1.hex()<br>'0x1.999999999999ap-4'<br>>>> 0.2.hex()<br>'0x1.999999999999ap-3'<br>>>> 0.3.hex()<br>'0x1.3333333333333p-2'<br>>>> (0.1+0.2).hex()<br>'0x1.3333333333334p-2'<br>>>> <br></div></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">This shows so clearly that there's 1 bit difference!<br></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/%7Eguido" target="_blank">python.org/~guido</a>)</div>
</div></div>