From f06203dd32a87901d39c0da8c3e1ab455eb0258b Mon Sep 17 00:00:00 2001 From: Harley White Date: Fri, 7 May 2021 18:53:49 -0400 Subject: [PATCH] Fixed formatting for small numbers --- changelog.md | 3 ++- js/utils/NumberFormating.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 3cd3220..6afc4aa 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # The Modding Tree changelog: -- Fixed issues in the buyable docs +- Improved the display for extremely small numbers. +- Fixed issues in the buyable docs. # v2.5.1 - 5/7/21 - Fixed dynamic things in tabFormat not updating. diff --git a/js/utils/NumberFormating.js b/js/utils/NumberFormating.js index 0fa5cc8..62b6e9b 100644 --- a/js/utils/NumberFormating.js +++ b/js/utils/NumberFormating.js @@ -59,12 +59,12 @@ function format(decimal, precision = 2, small) { decimal = invertOOM(decimal) let val = "" - if (decimal.lt(1e1000)){ + if (decimal.lt("1e1000")){ val = exponentialFormat(decimal, precision) + return val.replace(/([^(?:e|F)]*)$/, '-$1') } else - val = format(decimal, precision) - return val.replace(/([^(?:e|F)]*)$/, '-$1') + return format(decimal, precision) + "⁻¹" }