Human readable bigint output changes

pull/16/head
Ishaan Bhardwaj 2021-02-10 12:45:55 -05:00 committed by GitHub
parent 32c2274bef
commit 77f24f5ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -138,7 +138,7 @@ function bigint.unserialize(big, output_type, precision)
-- Unserialization to human-readable form or scientific notation only
-- requires reading the first few digits
if (precision == nil) then
precision = 3
precision = math.min(#big.digits, 3)
else
assert(precision > 0, "Precision cannot be less than 1")
assert(math.floor(precision) == precision,
@ -157,7 +157,8 @@ function bigint.unserialize(big, output_type, precision)
if ((output_type == "human-readable")
or (output_type == "human")
or (output_type == "h")) then
or (output_type == "h"))
and (#big.digits >= 3 and #big.digits <= 10002) then
-- Human-readable output contributed by 123eee555
local name