We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 721a41c commit 444523bCopy full SHA for 444523b
packages/math/src/decimal.ts
@@ -91,7 +91,10 @@ export class Decimal {
91
92
public static compare(a: Decimal, b: Decimal): number {
93
if (a.fractionalDigits !== b.fractionalDigits) throw new Error("Fractional digits do not match");
94
- return Math.sign(Number(a.data.atomics - b.data.atomics));
+ const difference = a.data.atomics - b.data.atomics;
95
+ if (difference < 0n) return -1;
96
+ if (difference > 0n) return 1;
97
+ return 0;
98
}
99
100
public get atomics(): string {
0 commit comments