summaryrefslogtreecommitdiff
path: root/web/src/math/Ratio.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/math/Ratio.ts')
-rw-r--r--web/src/math/Ratio.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/web/src/math/Ratio.ts b/web/src/math/Ratio.ts
index d8e1149..0cca966 100644
--- a/web/src/math/Ratio.ts
+++ b/web/src/math/Ratio.ts
@@ -50,6 +50,13 @@ export default class Ratio {
);
}
+ subtract(other: Ratio): Ratio {
+ return new Ratio(
+ this.numerator * other.denominator - other.numerator * this.denominator,
+ this.denominator * other.denominator,
+ );
+ }
+
compare(other: Ratio): number {
const left = this.numerator * other.denominator;
const right = other.numerator * this.denominator;