A
Alex DeCaria
Is there a built-in method to set a floating point value to NaN or
Infinity? Or, is the only way to do this by
a = 0.0/0.0 # set a to NaN
b = 3.0/0.0 # set b to Infinity
c = -3.0/0.0 # set c to -Infinity
Also, how can I set value to -NaN? This is possible in other languages,
but I can't do it in Ruby. I've tried:
a = 0.0/0.0
b = -a
but b still comes out NaN.
--Alex
Infinity? Or, is the only way to do this by
a = 0.0/0.0 # set a to NaN
b = 3.0/0.0 # set b to Infinity
c = -3.0/0.0 # set c to -Infinity
Also, how can I set value to -NaN? This is possible in other languages,
but I can't do it in Ruby. I've tried:
a = 0.0/0.0
b = -a
but b still comes out NaN.
--Alex