Improved regularFormat on small numbers
This commit is contained in:
parent
3f10abbb09
commit
65e265768b
1 changed files with 4 additions and 1 deletions
|
@ -48,7 +48,10 @@ export function regularFormat(num: DecimalSource, precision: number): string {
|
||||||
return (0).toFixed(precision);
|
return (0).toFixed(precision);
|
||||||
}
|
}
|
||||||
if (num.mag < 0.1 && precision !== 0) {
|
if (num.mag < 0.1 && precision !== 0) {
|
||||||
precision = Math.max(Math.max(precision, 4), projInfo.defaultDecimalsShown);
|
precision = Math.max(
|
||||||
|
Math.max(precision, num.log10().negate().ceil().toNumber()),
|
||||||
|
projInfo.defaultDecimalsShown
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return num.toStringWithDecimalPlaces(precision);
|
return num.toStringWithDecimalPlaces(precision);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue