mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-09 17:23:53 +01:00
Fix ram<1GB display bug
This commit is contained in:
parent
6b8ae1b351
commit
bba6b26ac1
@ -74,6 +74,9 @@ export function formatRam(n: number, fractionalDigits = 2) {
|
||||
// Special handling for Infinities
|
||||
if (nAbs === Infinity) return `${n < 0 ? "-∞" : ""}∞${ramSuffixList.at(-1)}`;
|
||||
|
||||
// Early return if using first suffix.
|
||||
if (nAbs < 1000) return getFormatter(fractionalDigits).format(n) + ramSuffixList[0];
|
||||
|
||||
// Ram always uses a suffix and never goes to exponential
|
||||
const suffixIndex = Math.min(Math.floor(ramLogFn(nAbs) / ramLogDivisor), ramSuffixList.length - 1);
|
||||
n /= ramExpList[suffixIndex];
|
||||
|
Loading…
Reference in New Issue
Block a user