<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Old Fortran wisdom from the stone age:<br>
<i>never test Floats for equality</i><br>
A Float is an approximation; there are an infinite number of values
that yield the same Float. Calculations with Floats are likely to
introduce rounding errors. Always test Floats for equality within a
tolerance.<br>
<br>
Float nan = Float nan is just one of the many tests that are
meaningless in practical programming.<br>
<br>
Cheers<br>
--Trygve<br>
<br>
<br>
<div class="moz-cite-prefix">On 04.09.2014 21:33, Eliot Miranda
wrote:<br>
</div>
<blockquote
cite="mid:CAC20JE3MENS6bGosiMwizpR_sM471pxFEYr557PdGdLSamjhyA@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Sep 3, 2014 at 4:11 PM, Chris
Muller <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</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">When
could it happen?<br>
<br>
A: With Float nan.<br>
<br>
Float nan == Float nan "true"<br>
<br>
Float nan = Float nan "false"<br>
<br>
It violates what I have long considered an invariant that
if a==b, then a=b.<br>
<br>
Real world context: When two DB clients change the same
object in the<br>
exact same way, it's not a conflict. If they change it
differently,<br>
it is.<br>
<br>
They've both made the same reference to Float nan, but
just asking if<br>
they made equivalent changes still reports false. So I
have to put in<br>
a complicated special check for NaN first..??<br>
<br>
Okay, I actually wrote: (a==b or: [a=b]) but who would
ever write<br>
that or not "simplify it" in teh future if they saw it?<br>
<br>
Comments? Why shouldn't Float nan = Float nan?<br>
</blockquote>
<div><br>
</div>
<div>Because non-a-numbers result from overflowing or
underflowing computations, and hence, just because two
computations produce the same not-a-number doesn't imply
that the two computations are equivalent. This is why
the <span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">IEEE-754
standard requires that NaN != NaN.</span></div>
</div>
-- <br>
best,
<div>Eliot</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="ProgId" content="Word.Document">
<meta name="Generator" content="Microsoft Word 10">
<meta name="Originator" content="Microsoft Word 10">
<link rel="File-List" href="TrygveSignature-filer/filelist.xml">
<br>
Trygve Reenskaug mailto: <a class="moz-txt-link-abbreviated" href="mailto:trygver@ifi.uio.no">trygver@ifi.uio.no</a>
<br>
Morgedalsvn. 5A <a class="moz-txt-link-freetext" href="http://folk.uio.no/trygver/">http://folk.uio.no/trygver/</a>
<br>
N-0378 Oslo <a class="moz-txt-link-freetext" href="http://fullOO.info">http://fullOO.info</a>
<br>
Norway Tel: (+47) 22 49 57 27
</div>
</body>
</html>