MLIR  19.0.0git
Public Member Functions | Public Attributes | List of all members
mlir::presburger::Fraction Struct Reference

A class to represent fractions. More...

#include "mlir/Analysis/Presburger/Fraction.h"

Public Member Functions

 Fraction ()=default
 Default constructor initializes the represented rational number to zero. More...
 
 Fraction (const MPInt &oNum, const MPInt &oDen=MPInt(1))
 Construct a Fraction from a numerator and denominator. More...
 
 Fraction (const MPInt &num, int64_t den)
 Overloads for passing literals. More...
 
 Fraction (int64_t num, const MPInt &den=MPInt(1))
 
 Fraction (int64_t num, int64_t den)
 
MPInt getAsInteger () const
 
llvm::raw_ostream & print (llvm::raw_ostream &os) const
 

Public Attributes

MPInt num {0}
 The numerator and denominator, respectively. More...
 
MPInt den {1}
 

Detailed Description

A class to represent fractions.

The sign of the fraction is represented in the sign of the numerator; the denominator is always positive.

Note that overflows may occur if the numerator or denominator are not representable by 64-bit integers.

Definition at line 28 of file Fraction.h.

Constructor & Destructor Documentation

◆ Fraction() [1/5]

mlir::presburger::Fraction::Fraction ( )
default

Default constructor initializes the represented rational number to zero.

◆ Fraction() [2/5]

mlir::presburger::Fraction::Fraction ( const MPInt oNum,
const MPInt oDen = MPInt(1) 
)
inline

Construct a Fraction from a numerator and denominator.

Definition at line 33 of file Fraction.h.

References den, and num.

◆ Fraction() [3/5]

mlir::presburger::Fraction::Fraction ( const MPInt num,
int64_t  den 
)
inline

Overloads for passing literals.

Definition at line 41 of file Fraction.h.

◆ Fraction() [4/5]

mlir::presburger::Fraction::Fraction ( int64_t  num,
const MPInt den = MPInt(1) 
)
inline

Definition at line 42 of file Fraction.h.

◆ Fraction() [5/5]

mlir::presburger::Fraction::Fraction ( int64_t  num,
int64_t  den 
)
inline

Definition at line 44 of file Fraction.h.

Member Function Documentation

◆ getAsInteger()

MPInt mlir::presburger::Fraction::getAsInteger ( ) const
inline

◆ print()

llvm::raw_ostream& mlir::presburger::Fraction::print ( llvm::raw_ostream &  os) const
inline

Definition at line 53 of file Fraction.h.

References den, and num.

Referenced by mlir::presburger::operator<<().

Member Data Documentation

◆ den

MPInt mlir::presburger::Fraction::den {1}

◆ num

MPInt mlir::presburger::Fraction::num {0}

The documentation for this struct was generated from the following file: