isfinite
function isfinite( x ) --> res
Description
Returns whether x is a finite value.
Parameters
- x
-
The number that should be checked.
Return Values
- res
-
true if x is a finite, otherwise false.
Code
--ZFUNC-isfinite-v1 local function isfinite( x ) --> res return x > -math.huge and x < math.huge end return isfinite
Examples
local t = require( "taptest" ) local isfinite = require( "isfinite" ) t( isfinite( 0.0 ), true ) t( isfinite( 1.0 / 0.0 ), false ) t( isfinite( -1.0 / 0.0 ), false ) t( isfinite( math.sqrt( -1.0 ) ), false ) t()