Human readable bigint output changes

This commit is contained in:
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

View File

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