[Mlir-commits] [mlir] [MLIR][Presburger] Implement arithmetic operations (/, +, -) and printing for Fractions (PR #65310)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Sep 5 07:05:55 PDT 2023
================
@@ -99,6 +103,23 @@ inline Fraction operator*(const Fraction &x, const Fraction &y) {
return Fraction(x.num * y.num, x.den * y.den);
}
+inline Fraction operator/(const Fraction &x, const Fraction &y) {
+ return Fraction(x.num * y.den, x.den * y.num);
+}
+
+inline Fraction operator+(const Fraction &x, const Fraction &y) {
+ return Fraction(x.num * y.den + x.den * y.num, x.den * y.den);
+}
+
+inline Fraction operator-(const Fraction &x, const Fraction &y) {
+ return Fraction(x.num * y.den - x.den * y.num, x.den * y.den);
+}
----------------
Abhinav271828 wrote:
Done!
https://github.com/llvm/llvm-project/pull/65310
More information about the Mlir-commits
mailing list