mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-11 04:42:34 +01:00
Fix ram<1GB display bug
This commit is contained in:
@ -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];
|
||||
|
Reference in New Issue
Block a user