[Mlir-commits] [mlir] [MLIR][Presburger] Add LLL basis reduction (PR #75565)
Arjun P
llvmlistbot at llvm.org
Sat Dec 16 08:22:39 PST 2023
================
@@ -124,6 +129,9 @@ inline Fraction operator-(const Fraction &x, const Fraction &y) {
return reduce(Fraction(x.num * y.den - x.den * y.num, x.den * y.den));
}
+// Find the integer nearest to a given fraction.
+inline MPInt round(const Fraction &f) { return floor(f + Fraction(1, 2)); }
----------------
Superty wrote:
this seems an unnecessarily expensive method. just check remainder rem = num % den and return {num - rem, den} or {num + den - rem, den} appropriately?
https://github.com/llvm/llvm-project/pull/75565
More information about the Mlir-commits
mailing list