fix(ui): correct rounding boundary comment from 999,500 to 999,950

This commit is contained in:
Narahari Raghava
2026-06-20 23:31:35 -05:00
committed by Vincent Koc
parent 5e602b1e06
commit d191da1a66
2 changed files with 2 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ describe("formatCompactTokenCount", () => {
});
it("rolls values that round up to 1000.0k over into the M branch instead of showing 1000k", () => {
// Regression test: 999,500-999,999 round to "1000.0" at one-decimal
// Regression test: 999,950-999,999 round to "1000.0" at one-decimal
// thousands precision. Before the fix, the >= 1_000_000 branch check
// ran on the raw value (which is still < 1_000_000), so these fell
// through to the k branch and displayed the nonsensical "1000k".

View File

@@ -4,7 +4,7 @@ export function formatCompactTokenCount(tokens: number): string {
return `${(tokens / 1_000_000).toFixed(1).replace(/\.0$/, "")}M`;
}
if (tokens >= 1_000) {
// Values from 999,500-999,999 round to "1000.0" at one-decimal
// Values from 999,950-999,999 round to "1000.0" at one-decimal
// thousands precision, which would display the nonsensical "1000k"
// instead of rolling over to the M branch above. Re-check the
// rounded result before formatting.