<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 8, 2014 at 10:15 PM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":54h" class="" style="overflow:hidden">Of course not. Numeric surprises are like bubbles under wallpaper: you<br>
can push them around, move them from place to place, but you cannot<br>
eliminate them entirely. (The analogy is not perfect: with wallpaper,<br>
you can push the bubble out to the edge, and at least sometimes,<br>
eliminate it.)</div></blockquote><div><br></div><div>Great analogy! I'll start using it with wallpaper covering floor,</div><div>ceiling as well as all four walls.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div id=":54h" class="" style="overflow:hidden">
<br>
Since Q is based on APL, I'm guessing that the surprise here is<br>
actually in the = equals operator. Is it doing a fuzzy comparison?</div></blockquote><div><br></div><div>Exactly.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div id=":54h" class="" style="overflow:hidden"> If so, that's also surprising, since that means you can have triplets of<br>
numbers such that a = b and b = c but a != c.</div></blockquote><div><br></div><div>Yes, but such triplets are not as easy to stumble upon as 1/3 + 1/3 + 1/3</div><div>and lack of transitivity is not something that novices are likely to complain</div>
<div>about.</div><div><br></div><div>You are absolutely right about not being able to eliminate all bubbles, but</div><div>we can move them away from the center of the wall to the corners and under</div><div>the wall-pictures.</div>
<div><br></div><div>In my view</div><div><br></div><div><div>>>> Decimal(1.1)</div><div>Decimal('1.100000000000000088817841970012523233890533447265625')</div></div><div><br></div><div>is a big bubble right in the middle of the wall.</div>
<div><br></div><div>The most obvious conversion from float to Decimal should implement the most</div><div>commonly needed operation. I cannot imagine anyone needing to convert</div><div>floats to 53-digit decimals in a real life application.</div>
</div><br><br></div></div>