diff options
| author | OpportunityLiu <[email protected]> | 2019-07-25 17:43:55 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-07-25 17:43:55 +0800 |
| commit | 980fe707e37687ceb5a2653298001845377136ee (patch) | |
| tree | d21cf5ef881d543d6256b4ae388bcb8178073134 /xmake/core/base/math.lua | |
| parent | 95169f0ec740f0466dfab97424e3c72460764f17 (diff) | |
refactor serialize functions
Diffstat (limited to 'xmake/core/base/math.lua')
| -rw-r--r-- | xmake/core/base/math.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/core/base/math.lua b/xmake/core/base/math.lua index a2dad7a6e..d49e8a8b9 100644 --- a/xmake/core/base/math.lua +++ b/xmake/core/base/math.lua @@ -25,6 +25,17 @@ local math = math or {} math.nan = math.log(-1) math.e = math.exp(1) +-- check a number is int +-- +-- @returns true for int, otherwise false +function math:isint() + + -- check + assert(type(self) == "number", "number expacted") + + return self == math.floor(self) and self ~= math.huge and self ~= -math.huge +end + -- check a number is inf or -inf -- -- @returns 1 for inf, -1 for -inf, otherwise false |
