isnan

function isnan( x ) --> res

Description

Returns whether x is a NaN(Not-a-Number) value.

Parameters

x

The number that should be checked.

Return Values

res

true if x is a NaN value, otherwise false.

Code

--ZFUNC-isnan-v1
local function isnan( x ) --> res
   return x ~= x
end

return isnan

Examples

local t = require( "tapered" )
local isnan = require( "isnan" )

t.nok( isnan( 0.0 ) )
t.nok( isnan( 1.0 / 0.0 ) )
t.nok( isnan( -1.0 / 0.0 ) )
t.ok( isnan( math.sqrt( -1.0 ) ) )

t.done()