On 11/26/2002 8:02 AM, James Mastros wrote:
Guys, can we please not argue over just how arithmetic and such works for NaN and Inf, and defer to IEEE specs (IEEE-754, AKA IEEE floating point)? It'll save much argument, and that's how it'll almost certianly be implemented anyway. Give examples and references, but don't define nonstandard "standard" perl6 semantics when a good standard exists. (I'm looking for a good reference on the IEEE semantics right now, but I'm not having much luck for some reason.)(Yes, I'm replying to myself.)
The best reference I can find right now is http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html. If anybody has a better one, I'd /love/ to see it. (IEEE-754 itself is non-free.)
(here -N is a negitive number, +N is a negive number, and N is any number (but not NaN or Inf).)
N / Inf => 0
Inf / Inf => NaN
# Multipication between infintes follows normal sign rules, and is infinite in result.
Inf * Inf => Inf
-N/0 => -Inf
0/0 => NaN
+N/0 => +Inf
Inf - Inf => NaN
Inf * 0 => NaN
All arithmetic ops with any arg NaN results in NaN. NaN==NaN is NaN, which is false. NaN!=NaN is also NaN, which is false.
-=- James Mastros