mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-24 09:21:46 +00:00
Tweaked number formatting
This commit is contained in:
parent
fabf31ccf6
commit
af05387b21
2 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
# The Modding Tree changelog:
|
||||
|
||||
- Tooltips can now show over the top overlay again.
|
||||
- Tweaked number formatting (e1000's keep the decimal places on the mantissa.)
|
||||
- Fixed text on two settings buttons not changing.
|
||||
|
||||
### v2.5.9.2 - 5/19/21
|
||||
|
|
|
@ -54,8 +54,8 @@ function format(decimal, precision = 2, small) {
|
|||
if (slog.gte(1e6)) return "F" + format(slog.floor())
|
||||
else return Decimal.pow(10, slog.sub(slog.floor())).toStringWithDecimalPlaces(3) + "F" + commaFormat(slog.floor(), 0)
|
||||
}
|
||||
else if (decimal.gte("1e100000")) return exponentialFormat(decimal, 0, false)
|
||||
else if (decimal.gte("1e1000")) return exponentialFormat(decimal, 0)
|
||||
else if (decimal.gte("1e1000000")) return exponentialFormat(decimal, 0, false)
|
||||
else if (decimal.gte("1e10000")) return exponentialFormat(decimal, 0)
|
||||
else if (decimal.gte(1e9)) return exponentialFormat(decimal, precision)
|
||||
else if (decimal.gte(1e3)) return commaFormat(decimal, 0)
|
||||
else if (decimal.gte(0.0001) || !small) return regularFormat(decimal, precision)
|
||||
|
@ -75,7 +75,7 @@ function format(decimal, precision = 2, small) {
|
|||
function formatWhole(decimal) {
|
||||
decimal = new Decimal(decimal)
|
||||
if (decimal.gte(1e9)) return format(decimal, 2)
|
||||
if (decimal.lte(0.98) && !decimal.eq(0)) return format(decimal, 2)
|
||||
if (decimal.lte(0.99) && !decimal.eq(0)) return format(decimal, 2)
|
||||
return format(decimal, 0)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue