Capy-Bearer Documentation

is_nan

lib call

Capy

function is_nan(value : f32) bool
function is_nan(value : f64) bool

Description

NaN is unequal to everything including itself, so value != value is the only other test. NaN arises from sqrt() of a negative number, 0.0 / 0.0, or log() of a negative number. f64(text, fallback: 0.0) never produces it from malformed input.

Parameters

value : a floating-point number

Return Values

true when value is not a number.

Example

Capy

print(is_nan(sqrt(-1.0)), " ", is_nan(1.0), "\n")

Output

true false