mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 16:09:02 -06:00
Fixed big division when (big1 < big2)
This commit is contained in:
parent
aa3eadc93d
commit
035f6dd7b4
@ -468,7 +468,7 @@ function bigint.divide_raw(big1, big2)
|
|||||||
if (bigint.compare(big1, big2, "==")) then
|
if (bigint.compare(big1, big2, "==")) then
|
||||||
return bigint.new(1), bigint.new(0)
|
return bigint.new(1), bigint.new(0)
|
||||||
elseif (bigint.compare(big1, big2, "<")) then
|
elseif (bigint.compare(big1, big2, "<")) then
|
||||||
return bigint.new(0), bigint.new(0)
|
return bigint.new(0), big1:clone()
|
||||||
else
|
else
|
||||||
assert(bigint.compare(big2, bigint.new(0), "!="), "error: divide by zero")
|
assert(bigint.compare(big2, bigint.new(0), "!="), "error: divide by zero")
|
||||||
assert(big1.sign == "+", "error: big1 is not positive")
|
assert(big1.sign == "+", "error: big1 is not positive")
|
||||||
|
Loading…
Reference in New Issue
Block a user