generated from nhcarrigan/template
fix: use Math.round in formatInteger letter suffix to avoid floating-point truncation
This commit is contained in:
@@ -127,7 +127,7 @@ const formatInteger = (value: number): string => {
|
|||||||
const steps = stepsAboveBase * 3;
|
const steps = stepsAboveBase * 3;
|
||||||
const divisorExp = letterBaseExp + steps;
|
const divisorExp = letterBaseExp + steps;
|
||||||
const divisor = Math.pow(10, divisorExp);
|
const divisor = Math.pow(10, divisorExp);
|
||||||
return `${String(Math.floor(value / divisor))}${getLetterSuffix(stepsAboveBase)}`;
|
return `${String(Math.round(value / divisor))}${getLetterSuffix(stepsAboveBase)}`;
|
||||||
}
|
}
|
||||||
for (const { threshold, suffix } of namedSuffixes) {
|
for (const { threshold, suffix } of namedSuffixes) {
|
||||||
if (value >= threshold) {
|
if (value >= threshold) {
|
||||||
|
|||||||
Reference in New Issue
Block a user