Skip to content

Modern Math IsNaN

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Math Library › Math Library › IsNaN

IsNaN

Returns true if the value is NaN, which an equality test cannot detect.

Syntax

IsNaN( x )

Examples

#import "std/numeric"
using numeric

print IsNaN( NaN( ) )        '' true
print IsNaN( 1.0 )            '' false

'' THE ONLY CORRECT TEST. A NaN is not equal to anything, itself
'' included, so `x = x` is false and `x <> x` is the old idiom this
'' replaces -- but only this one says what it means.
dim as float64 n = NaN( )
print ( n = n )               '' 0 -- false, printed as an integer because
                              '' a comparison of doubles is not a BOOLEAN

Library: Math Library
Category: Math Library
Documented under: Nothing Becomes A Keyword

Clone this wiki locally