commit a5cc9a3a7b2a78a3ead0f3a06032bc705c982a13 parent ab96c2fdde00311ce545cb9c54a44629efc5437c Author: NunoSempere <nuno.sempere@protonmail.com> Date: Tue, 3 May 2022 12:55:21 -0400 fix: display output Diffstat:
| M | src/index.js | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/index.js b/src/index.js @@ -239,14 +239,19 @@ let customToStringHandlerToGuesstimateSyntax = (node, options) => { } }; -let toPrecision2 = (f) => f.toPrecision(2).toString(); +let toPrecision2 = (f) => f.toPrecision(2); +let numToString = (x) => + x < 10 + ? toPrecision2(x).toLocaleString() + : BigInt(Math.round(toPrecision2(x))).toString(); + let toShortGuesstimateString = (node) => { if (isArgLognormal(node)) { let factors = getFactors(node); // print(node); // print(factors); let ninetyPercentCI = to90PercentCI(factors[0], factors[1]); - return `${toPrecision2(ninetyPercentCI[0])} to ${toPrecision2( + return `${numToString(ninetyPercentCI[0])} to ${numToString( ninetyPercentCI[1] )}`; } else {