1,043
edits
(Created page with "local IP = { INFINITY = 1 / 0, } local function isNatural(value) return math.floor(value) == value and value >= 0 end local function isProbability(value) return...") |
(fix errors in assertion predicates) |
||
Line 4: | Line 4: | ||
local function isNatural(value) | local function isNatural(value) | ||
return math.floor(value) == value and value >= 0 | return type(value) == 'number' | ||
and math.floor(value) == value | |||
and value >= 0 | |||
end | end | ||
local function isProbability(value) | local function isProbability(value) | ||
return 0 <= value and value <= 1 | return type(value) == 'number' | ||
and 0 <= value | |||
and value <= 1 | |||
end | end | ||