Fixed FixedNumber rounding for non-default formats (#1629).

This commit is contained in:
Richard Moore 2021-05-31 17:37:56 -04:00
parent 470551e4ee
commit 8681cd5969
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -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 {