Difference between revisions of "Talk:Not a Number"
Colin-adams (Talk | contribs) |
Peter gummer (Talk | contribs) (→One possibility for working with NaN) |
||
Line 5: | Line 5: | ||
I was working on a project to represent complex numbers and used the following `is_equal' to accomodate the use of NaNs: | I was working on a project to represent complex numbers and used the following `is_equal' to accomodate the use of NaNs: | ||
− | + | <e> | |
is_equal (other: like Current): BOOLEAN | is_equal (other: like Current): BOOLEAN | ||
-- Is `other' attached to an object considered | -- Is `other' attached to an object considered | ||
Line 24: | Line 24: | ||
end | end | ||
end | end | ||
+ | </e> | ||
--[[User:Colin-adams|Colin-adams]] 10:17, 22 February 2010 (UTC) Can you format that code? I can't follow it at all as it stands. | --[[User:Colin-adams|Colin-adams]] 10:17, 22 February 2010 (UTC) Can you format that code? I can't follow it at all as it stands. | ||
+ | |||
+ | ---[[User:Peter gummer|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? |
Revision as of 05:44, 22 February 2010
--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?