isinf

function isinf( x ) --> res

Description

Returns whether x is an infinity value (either positive infinity or negative infinity).

Parameters

x

The number that should be checked.

Return Values

res

true if x is an infinity, otherwise false.

Code

--ZFUNC-isinf-v1
local function isinf( x ) --> res
   return x == math.huge or x == -math.huge
end

return isinf

Examples

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

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

t.done()