Fixed FixedNumber rounding for non-default formats (#1629).
This commit is contained in:
parent
470551e4ee
commit
8681cd5969
@ -288,8 +288,10 @@ export class FixedNumber {
|
||||
|
||||
if (comps[1].length <= decimals) { return this; }
|
||||
|
||||
const factor = FixedNumber.from("1" + zeros.substring(0, decimals));
|
||||
return this.mulUnsafe(factor).addUnsafe(BUMP).floor().divUnsafe(factor);
|
||||
const factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format);
|
||||
const bump = BUMP.toFormat(this.format);
|
||||
|
||||
return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);
|
||||
}
|
||||
|
||||
isZero(): boolean {
|
||||
|
Loading…
Reference in New Issue
Block a user