Availability:built-in
[det]float_class(+Float,
-Class)Wraps C99 fpclassify() to access the class of a floating point
number. Raises a type error if Float is not a float. Defined
classes are below.
- nan
- Float is “Not a number” . See nan/0.
May be produced if the Prolog flag float_undefined
is set to
nan
. Although IEEE 754 allows NaN to carry a payload
and have a sign, SWI-Prolog has only a single NaN values. Note that two
NaN
terms compare equal in the standard order of terms (==/2,
etc.), they compare non-equal for arithmetic (=:=/2,
etc.).
- infinite
- Float is positive or negative infinity. See inf/0.
May be produced if the Prolog flag float_overflow
or the flag float_zero_div
is set to
infinity
.
- zero
- Float is zero (0.0 or -0.0)
- subnormal
- Float is too small to be represented in normalized format.
May not be produced if the Prolog flag
float_underflow
is set to
error
.
- normal
- Float is a normal floating point number.