cprover
rationalt Class Reference

#include <rational.h>

Public Member Functions

 rationalt ()
 
 rationalt (const mp_integer &i)
 
 rationalt (int i)
 
rationaltoperator+= (const rationalt &n)
 
rationaltoperator-= (const rationalt &n)
 
rationaltoperator- ()
 
rationaltoperator*= (const rationalt &n)
 
rationaltoperator/= (const rationalt &n)
 
bool operator== (const rationalt &n) const
 
bool operator!= (const rationalt &n) const
 
bool operator< (const rationalt &n) const
 
bool operator<= (const rationalt &n) const
 
bool operator>= (const rationalt &n) const
 
bool operator> (const rationalt &n) const
 
bool is_zero () const
 
bool is_one () const
 
bool is_negative () const
 
void invert ()
 
const mp_integerget_numerator () const
 
const mp_integerget_denominator () const
 

Protected Member Functions

void normalize ()
 
void same_denominator (rationalt &n)
 

Protected Attributes

mp_integer numerator
 
mp_integer denominator
 

Detailed Description

Definition at line 20 of file rational.h.

Constructor & Destructor Documentation

◆ rationalt() [1/3]

rationalt::rationalt ( )
inline

Definition at line 31 of file rational.h.

◆ rationalt() [2/3]

rationalt::rationalt ( const mp_integer i)
inlineexplicit

Definition at line 32 of file rational.h.

◆ rationalt() [3/3]

rationalt::rationalt ( int  i)
inlineexplicit

Definition at line 33 of file rational.h.

Member Function Documentation

◆ get_denominator()

const mp_integer& rationalt::get_denominator ( ) const
inline

Definition at line 95 of file rational.h.

References denominator.

Referenced by from_rational(), and operator<<().

◆ get_numerator()

const mp_integer& rationalt::get_numerator ( ) const
inline

Definition at line 90 of file rational.h.

References numerator.

Referenced by from_rational(), and operator<<().

◆ invert()

void rationalt::invert ( )

Definition at line 91 of file rational.cpp.

References denominator, and numerator.

Referenced by inverse().

◆ is_negative()

bool rationalt::is_negative ( ) const
inline

Definition at line 85 of file rational.h.

References is_zero(), and numerator.

◆ is_one()

bool rationalt::is_one ( ) const
inline

Definition at line 82 of file rational.h.

References denominator, is_zero(), and numerator.

Referenced by exprt::is_one(), and simplify_exprt::simplify_div().

◆ is_zero()

bool rationalt::is_zero ( ) const
inline

Definition at line 79 of file rational.h.

References numerator.

Referenced by is_negative(), is_one(), exprt::is_zero(), and simplify_exprt::simplify_div().

◆ normalize()

void rationalt::normalize ( )
protected

Definition at line 58 of file rational.cpp.

References denominator, and numerator.

Referenced by operator*=(), operator+=(), operator-=(), and operator/=().

◆ operator!=()

bool rationalt::operator!= ( const rationalt n) const
inline

Definition at line 48 of file rational.h.

References numerator.

◆ operator*=()

rationalt & rationalt::operator*= ( const rationalt n)

Definition at line 41 of file rational.cpp.

References denominator, normalize(), and numerator.

◆ operator+=()

rationalt & rationalt::operator+= ( const rationalt n)

Definition at line 17 of file rational.cpp.

References normalize(), numerator, and same_denominator().

◆ operator-()

rationalt & rationalt::operator- ( )

Definition at line 35 of file rational.cpp.

References numerator.

◆ operator-=()

rationalt & rationalt::operator-= ( const rationalt n)

Definition at line 26 of file rational.cpp.

References normalize(), numerator, and same_denominator().

◆ operator/=()

rationalt & rationalt::operator/= ( const rationalt n)

Definition at line 49 of file rational.cpp.

References denominator, normalize(), and numerator.

◆ operator<()

bool rationalt::operator< ( const rationalt n) const
inline

Definition at line 55 of file rational.h.

References numerator.

◆ operator<=()

bool rationalt::operator<= ( const rationalt n) const
inline

Definition at line 62 of file rational.h.

References numerator.

◆ operator==()

bool rationalt::operator== ( const rationalt n) const
inline

Definition at line 41 of file rational.h.

References numerator.

◆ operator>()

bool rationalt::operator> ( const rationalt n) const
inline

Definition at line 74 of file rational.h.

◆ operator>=()

bool rationalt::operator>= ( const rationalt n) const
inline

Definition at line 69 of file rational.h.

◆ same_denominator()

void rationalt::same_denominator ( rationalt n)
protected

Definition at line 78 of file rational.cpp.

References denominator, and numerator.

Referenced by operator+=(), and operator-=().

Member Data Documentation

◆ denominator

mp_integer rationalt::denominator
protected

◆ numerator


The documentation for this class was generated from the following files: