# Talk:Not a Number

Revision as of 06:44, 22 February 2010 by Peter gummer (Talk | contribs) (→One possibility for working with NaN)

**--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

--Colin-adams 10:17, 22 February 2010 (UTC) Can you format that code? I can't follow it at all as it stands.

---Peter gummer 14:44, 22 February 2010 (UTC): Whoever pasted the code there had formatted it, but without suitable mark-up it came out on one line. I've added the mark-up ... how's that look now?