MLIR 22.0.0git
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.
 Fraction (const DynamicAPInt &oNum, const DynamicAPInt &oDen=DynamicAPInt(1))
 Construct a Fraction from a numerator and denominator.
 Fraction (const DynamicAPInt &num, int64_t den)
 Overloads for passing literals.
 Fraction (int64_t num, const DynamicAPInt &den=DynamicAPInt(1))
 Fraction (int64_t num, int64_t den)
DynamicAPInt getAsInteger () const
llvm::raw_ostream & print (llvm::raw_ostream &os) const

Public Attributes

DynamicAPInt num {0}
 The numerator and denominator, respectively.
DynamicAPInt 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 29 of file Fraction.h.

Constructor & Destructor Documentation

◆ Fraction() [1/5]

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

Default constructor initializes the represented rational number to zero.

Referenced by Fraction(), Fraction(), and Fraction().

◆ Fraction() [2/5]

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

Construct a Fraction from a numerator and denominator.

Definition at line 34 of file Fraction.h.

References den, and num.

◆ Fraction() [3/5]

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

Overloads for passing literals.

Definition at line 42 of file Fraction.h.

References den, Fraction(), and num.

◆ Fraction() [4/5]

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

Definition at line 44 of file Fraction.h.

References den, Fraction(), and num.

◆ Fraction() [5/5]

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

Definition at line 46 of file Fraction.h.

References den, Fraction(), and num.

Member Function Documentation

◆ getAsInteger()

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

◆ print()

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

Definition at line 56 of file Fraction.h.

References den, and num.

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

Member Data Documentation

◆ den

◆ num


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