From 77f24f5ee51e1de6e962e7e1caf80bb3a727e88c Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj <59454579+SashLilac@users.noreply.github.com> Date: Wed, 10 Feb 2021 12:45:55 -0500 Subject: [PATCH] Human readable bigint output changes --- libs/bigint/bigint.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/bigint/bigint.lua b/libs/bigint/bigint.lua index 14988c9..19b02b1 100644 --- a/libs/bigint/bigint.lua +++ b/libs/bigint/bigint.lua @@ -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