As nan != nan
, is_nan
should be used to test if a float is the special not a number value.
assert nan != nan # By IEEE 754
assert nan.is_nan
assert not 10.0.is_nan
# Returns true is self is not a number.
#
# As `nan != nan`, `is_nan` should be used to test if a float is the special *not a number* value.
#
# ~~~
# assert nan != nan # By IEEE 754
# assert nan.is_nan
# assert not 10.0.is_nan
# ~~~
fun is_nan: Bool `{ return isnan(self); `}
lib/core/math.nit:304,2--313,43