On Thu, Apr 1, 2010 at 10:21 PM, Mike S. [email protected] wrote:
On Apr 1, 2010, at 3:48 PM, Colin B. wrote:
In the past I have done something like:
Float::NaN = 0.0 / 0.0 #=> NaN
Float::Infinity = 3.0 / 1.0 #=> Infinity
That’s a pretty small infinity
Well, us wot have studied maffematics can deal with LOADS of infinitys!
Or, in other words, oops!
Yes that should have been
Float::Infinity = 3.0 / 0.0 #=> Infinity
Alex DeCaria to ruby-talk wrote:
I’m curious: which languages have a -NaN value and why would you want
to use it instead of just NaN?
I do a lot of my scientific programming in IDL. It allows explicit
assignment of NaN and -NaN to floating point variables, as well as
returns -NaN under certain circumstances. IDL is used for a lot of
image processing, and being able to have NaN and/or -NaN is useful as a
mask when processing the arrays.
As far as I know, Ruby uses “standard” floating point (so no negative
or “signed” NaN?), but I think we now need an answer from an expert.