Talk:Not a Number

Revision as of 19:18, 19 February 2010 by Saunders (Talk | contribs) (One possibility for working with NaN: new section)

--manus 19:37, 8 May 2007 (CEST): Have a look at Real Numbers page where we already started a similar discussion but currently only for the specification of REAL_64, not its usage.

One possibility for working with NaN

I was working on a project to represent complex numbers and used the following `is_equal' to accomodate the use of NaNs:


is_equal (other: like Current): BOOLEAN -- Is `other' attached to an object considered -- equal to current object? -- If current object is not a number (NaN) and -- `other' is as well `True' will be returned. do if is_nan then if real /~ real and then imaginary ~ imaginary then Result := real /~ other.real and then imaginary ~ other.imaginary elseif real ~ real and then imaginary /~ imaginary then Result := real ~ other.real and then imaginary /~ other.imaginary elseif real /~ real and then imaginary /~ imaginary then Result := real /~ other.real and then imaginary /~ other.imaginary end else Result := real ~ other.real and then imaginary ~ other.imaginary end end