Added another type check to the bigint

This commit is contained in:
Ishaan Bhardwaj 2021-02-10 11:15:56 -05:00 committed by GitHub
parent 8418fc8ab7
commit 4920e5de1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,8 @@ function bigint.check(big, force)
assert(type(big.sign) == "string", "bigint is unsigned") assert(type(big.sign) == "string", "bigint is unsigned")
for _, digit in pairs(big.digits) do for _, digit in pairs(big.digits) do
assert(type(digit) == "number", digit .. " is not a number") assert(type(digit) == "number", digit .. " is not a number")
assert(digit < 10, digit .. " is greater than or equal to 10") assert(digit <= 9 and digit >= 0, digit .. " is not between 0 and 9")
assert(math.floor(digit) == digit, digit .. " is not an integer")
end end
end end
return true return true