<div dir="ltr"><div>Hi Stephane,</div><div>I have unpublished nasty tests showing such kind of weakness of closeTo:</div><div><br></div><div>We can use either an absolute precision, or a relative one, but if we try to handle both in same message, we'll get in trouble at the boundaries.</div><div>The scheme that might work for comparing x and y is to use prescribed precision as boundary like this:</div><div><br></div><div>(xy := x abs max: y abs) > precision</div><div>    ifTrue:</div><div>        ["use relative precision"</div><div>        ^(x-y) abs <= (xy * precision)].</div><div>"use absolute precision"</div><div>^(x-y) abs <= precision<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le dim. 8 mars 2020 à 11:23, Stéphane Rollandin <<a href="mailto:lecteur@zogotounga.net">lecteur@zogotounga.net</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">>       (self closeTo: 0.0) ifTrue: [^self abs < 0.0001].<br>
<br>
typo: it's<br>
        (self closeTo: 0.0) ifTrue: [^num abs < 0.0001].<br>
<br>
Stef<br>
<br>
</blockquote></div>