From 65e265768bac65e07f7598c9fe9cbdf9495a2fe6 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Fri, 20 May 2022 16:50:19 -0500 Subject: [PATCH] Improved regularFormat on small numbers --- src/util/break_eternity.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/break_eternity.ts b/src/util/break_eternity.ts index 9aae08e..e853751 100644 --- a/src/util/break_eternity.ts +++ b/src/util/break_eternity.ts @@ -48,7 +48,10 @@ export function regularFormat(num: DecimalSource, precision: number): string { return (0).toFixed(precision); } if (num.mag < 0.1 && precision !== 0) { - precision = Math.max(Math.max(precision, 4), projInfo.defaultDecimalsShown); + precision = Math.max( + Math.max(precision, num.log10().negate().ceil().toNumber()), + projInfo.defaultDecimalsShown + ); } return num.toStringWithDecimalPlaces(precision); }