<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>
    &nbsp;&nbsp;&nbsp; <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">&lt;<a moz-do-not-send="true"
                href="mailto:ma.chris.m@gmail.com" target="_blank">ma.chris.m@gmail.com</a>&gt;</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:&nbsp; With Float nan.<br>
              <br>
              &nbsp; &nbsp;Float nan == Float nan&nbsp; &nbsp;"true"<br>
              <br>
              &nbsp; &nbsp;Float nan = Float nan&nbsp; &nbsp;"false"<br>
              <br>
              It violates what I have long considered an invariant that
              if a==b, then a=b.<br>
              <br>
              Real world context:&nbsp; When two DB clients change the same
              object in the<br>
              exact same way, it's not a conflict.&nbsp; 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.&nbsp; So I
              have to put in<br>
              a complicated special check for NaN first..??<br>
              <br>
              Okay, I actually wrote:&nbsp; (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?&nbsp; 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. &nbsp;This is why
              the&nbsp;<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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mailto: <a class="moz-txt-link-abbreviated" href="mailto:trygver@ifi.uio.no">trygver@ifi.uio.no</a>
      <br>
      Morgedalsvn. 5A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="moz-txt-link-freetext" href="http://folk.uio.no/trygver/">http://folk.uio.no/trygver/</a>
      <br>
      N-0378 Oslo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="moz-txt-link-freetext" href="http://fullOO.info">http://fullOO.info</a>
      <br>
      Norway&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tel: (+47) 22 49 57 27
    </div>
  </body>
</html>