CBMC
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 15 of file rational.h.

Constructor & Destructor Documentation

◆ rationalt() [1/3]

rationalt::rationalt ( )
inline

Definition at line 26 of file rational.h.

◆ rationalt() [2/3]

rationalt::rationalt ( const mp_integer i)
inlineexplicit

Definition at line 27 of file rational.h.

◆ rationalt() [3/3]

rationalt::rationalt ( int  i)
inlineexplicit

Definition at line 28 of file rational.h.

Member Function Documentation

◆ get_denominator()

const mp_integer& rationalt::get_denominator ( ) const
inline

Definition at line 90 of file rational.h.

◆ get_numerator()

const mp_integer& rationalt::get_numerator ( ) const
inline

Definition at line 85 of file rational.h.

◆ invert()

void rationalt::invert ( )

Definition at line 92 of file rational.cpp.

◆ is_negative()

bool rationalt::is_negative ( ) const
inline

Definition at line 80 of file rational.h.

◆ is_one()

bool rationalt::is_one ( ) const
inline

Definition at line 77 of file rational.h.

◆ is_zero()

bool rationalt::is_zero ( ) const
inline

Definition at line 74 of file rational.h.

◆ normalize()

void rationalt::normalize ( )
protected

Definition at line 59 of file rational.cpp.

◆ operator!=()

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

Definition at line 43 of file rational.h.

◆ operator*=()

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

Definition at line 42 of file rational.cpp.

◆ operator+=()

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

Definition at line 18 of file rational.cpp.

◆ operator-()

rationalt & rationalt::operator- ( )

Definition at line 36 of file rational.cpp.

◆ operator-=()

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

Definition at line 27 of file rational.cpp.

◆ operator/=()

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

Definition at line 50 of file rational.cpp.

◆ operator<()

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

Definition at line 50 of file rational.h.

◆ operator<=()

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

Definition at line 57 of file rational.h.

◆ operator==()

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

Definition at line 36 of file rational.h.

◆ operator>()

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

Definition at line 69 of file rational.h.

◆ operator>=()

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

Definition at line 64 of file rational.h.

◆ same_denominator()

void rationalt::same_denominator ( rationalt n)
protected

Definition at line 79 of file rational.cpp.

Member Data Documentation

◆ denominator

mp_integer rationalt::denominator
protected

Definition at line 19 of file rational.h.

◆ numerator

mp_integer rationalt::numerator
protected

Definition at line 18 of file rational.h.


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