14 #ifndef MLIR_ANALYSIS_PRESBURGER_FRACTION_H
15 #define MLIR_ANALYSIS_PRESBURGER_FRACTION_H
21 namespace presburger {
47 assert(
num %
den == 0 &&
"Get as integer called on non-integral fraction!");
This class provides support for multi-precision arithmetic.
LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt ceilDiv(const MPInt &lhs, const MPInt &rhs)
bool operator==(const Fraction &x, const Fraction &y)
bool operator>(const Fraction &x, const Fraction &y)
bool operator<(const Fraction &x, const Fraction &y)
int compare(const Fraction &x, const Fraction &y)
Three-way comparison between two fractions.
bool operator>=(const Fraction &x, const Fraction &y)
Fraction operator-(const Fraction &x)
bool operator<=(const Fraction &x, const Fraction &y)
MPInt ceil(const Fraction &f)
bool operator!=(const Fraction &x, const Fraction &y)
Fraction operator*(const Fraction &x, const Fraction &y)
MPInt floor(const Fraction &f)
LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt floorDiv(const MPInt &lhs, const MPInt &rhs)
Include the generated interface declarations.
A class to represent fractions.
Fraction(int64_t num, const MPInt &den)
Fraction()=default
Default constructor initializes the represented rational number to zero.
Fraction(const MPInt &oNum, const MPInt &oDen)
Construct a Fraction from a numerator and denominator.
MPInt getAsInteger() const
Fraction(const MPInt &num, int64_t den)
Overloads for passing literals.
Fraction(int64_t num, int64_t den)
MPInt num
The numerator and denominator, respectively.