Not a Number, representation of an undefined or unrepresentable float (IEEE 754).

nan is not comparable with itself, you should use Float::is_nan to test it.

assert nan.is_nan
assert nan != nan

nan is the quiet result of some undefined operations.

assert (1.0 + nan).is_nan
assert (0.0 / 0.0).is_nan
assert (inf - inf).is_nan
assert (inf / inf).is_nan
assert (-1.0).sqrt.is_nan

Property definitions

core :: math $ Sys :: nan
# Not a Number, representation of an undefined or unrepresentable float (IEEE 754).
#
# `nan` is not comparable with itself, you should use `Float::is_nan` to test it.
#
# ~~~
# assert nan.is_nan
# assert nan != nan # By IEEE 754
# ~~~
#
# `nan` is the quiet result of some undefined operations.
#
# ~~~
# assert (1.0 + nan).is_nan
# assert (0.0 / 0.0).is_nan
# assert (inf - inf).is_nan
# assert (inf / inf).is_nan
# assert (-1.0).sqrt.is_nan
# ~~~
fun nan: Float do return 0.0 / 0.0
lib/core/math.nit:403,1--421,34