Value of not-a-number : nan « Number « Ruby






Value of not-a-number


nan = 0.0/0.0;     # zero divided by zero is not-a-number
nan < 0            # false: it is not less than zero
nan > 0            # false: it is not greater than zero
nan == 0           # false: it is not equal to zero
nan == nan         # false: it is not even equal to itself!
nan.equal?(nan)    # this is true, of course

 








Related examples in the same category

1.Is it not a number
2.Inspect a not-a-number
3.Is it an integer
4.If it is an integer