Effective implementation of algorithms (Master Thesis)
Effective and error-free implementation of algorithms
math::rational Namespace Reference

Classes

class  Rational

Functions

template<typename T >
Rational< T > operator- (const Rational< T > &a)
template<typename T >
bool operator== (const Rational< T > &a, const Rational< T > &b)
template<typename T >
bool operator< (const Rational< T > &a, const Rational< T > &b)
template<typename T >
bool operator> (const Rational< T > &a, const Rational< T > &b)
template<typename T >
bool operator<= (const Rational< T > &a, const Rational< T > &b)
template<typename T >
bool operator>= (const Rational< T > &a, const Rational< T > &b)
template<typename T >
std::ostream & operator<< (std::ostream &out, const Rational< T > &a)

Function Documentation

template<typename T >
Rational<T> math::rational::operator- ( const Rational< T > &  a)

Unary minus

Returns:
-a
template<typename T >
bool math::rational::operator< ( const Rational< T > &  a,
const Rational< T > &  b 
)

Test inequality of fractions

Returns:
true iff a is less than b
template<typename T >
std::ostream& math::rational::operator<< ( std::ostream &  out,
const Rational< T > &  a 
)

Write fraction to stream in form "a/b" where a/b is normalized fraction

Precondition:
  • Fraction should be normalized, this hold unless you modify class members directly.
Parameters:
outstream to be used
anumber to be written
Returns:
stream out
template<typename T >
bool math::rational::operator<= ( const Rational< T > &  a,
const Rational< T > &  b 
)

Test inequality of fractions

Returns:
true iff a is less or equal than b
template<typename T >
bool math::rational::operator== ( const Rational< T > &  a,
const Rational< T > &  b 
)

Test equality of fractions

Precondition:
  • Fractions should be normalized first, this is done automatically unless you modify fraction's member variables
Returns:
true iff a is equal to b
template<typename T >
bool math::rational::operator> ( const Rational< T > &  a,
const Rational< T > &  b 
)

Test inequality of fractions

Returns:
true iff a is greater than b
template<typename T >
bool math::rational::operator>= ( const Rational< T > &  a,
const Rational< T > &  b 
)

Test inequality of fractions

Returns:
true iff a is greated or equals to b
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines