Claw  1.7.3
Public Types | Public Member Functions | Friends | List of all members
claw::real_number< T > Class Template Reference

Custom precision real numbers. More...

#include <real_number.hpp>

Public Types

typedef T value_type
typedef real_number< T > self_type

Public Member Functions

 real_number ()
 Constructuor.
 real_number (const value_type &v)
 Constructor.
 real_number (const self_type &that)
 Copy constructor.
self_type abs () const
 Get the absolute value of the number.
bool operator< (const self_type &that) const
 Tell if this number is stricty lower than an other number.
bool operator<= (const self_type &that) const
 Tell if this number is lower or equal to an other number.
bool operator> (const self_type &that) const
 Tell if this number is stricty greater than an other number.
bool operator>= (const self_type &that) const
 Tell if this number is greater or equal to an other number.
bool operator== (const self_type &that) const
 Tell if this number is equal to an other number.
bool operator!= (const self_type &that) const
 Tell if this number is not equal to an other number.
self_type operator+ (const self_type &that) const
 Sum two numbers.
self_type operator- (const self_type &that) const
 Get the difference of two numbers.
self_type operator* (const self_type &that) const
 Multiply two numbers.
self_type operator/ (const self_type &that) const
 Divide by an other number.
self_typeoperator+= (const self_type &that)
 Add an other number.
self_typeoperator-= (const self_type &that)
 Subtract an other number.
self_typeoperator*= (const self_type &that)
 Multiply by an other number.
self_typeoperator/= (const self_type &that)
 Divide by an other number.
std::ostream & output (std::ostream &os) const
 Output the value in a stream.
template<typename U >
 operator U () const
 Cast the value.

Friends

std::istream & operator>> (std::istream &is, real_number< T > &self)
 Read a number from a stream.

Detailed Description

template<typename T>
class claw::real_number< T >

Custom precision real numbers.

Author
Julien Jorge

Definition at line 67 of file real_number.hpp.

Constructor & Destructor Documentation

template<typename T >
claw::real_number< T >::real_number ( const value_type &  v)

Constructor.

Parameters
vThe value of the number.

Definition at line 49 of file real_number.tpp.

template<typename T >
claw::real_number< T >::real_number ( const self_type that)

Copy constructor.

Parameters
thatThe instance to copy from.

Definition at line 61 of file real_number.tpp.

Member Function Documentation

template<typename T >
bool claw::real_number< T >::operator!= ( const self_type that) const

Tell if this number is not equal to an other number.

Parameters
thatThe other number.

Definition at line 155 of file real_number.tpp.

template<typename T >
claw::real_number< T >::self_type claw::real_number< T >::operator* ( const self_type that) const

Multiply two numbers.

Parameters
thatThe other number.

Definition at line 191 of file real_number.tpp.

template<typename T >
claw::real_number< T >::self_type & claw::real_number< T >::operator*= ( const self_type that)

Multiply by an other number.

Parameters
thatThe other number.

Definition at line 243 of file real_number.tpp.

template<typename T >
claw::real_number< T >::self_type claw::real_number< T >::operator+ ( const self_type that) const

Sum two numbers.

Parameters
thatThe other number.

Definition at line 167 of file real_number.tpp.

template<typename T >
claw::real_number< T >::self_type & claw::real_number< T >::operator+= ( const self_type that)

Add an other number.

Parameters
thatThe other number.

Definition at line 215 of file real_number.tpp.

template<typename T >
claw::real_number< T >::self_type claw::real_number< T >::operator- ( const self_type that) const

Get the difference of two numbers.

Parameters
thatThe other number.

Definition at line 179 of file real_number.tpp.

template<typename T >
claw::real_number< T >::self_type & claw::real_number< T >::operator-= ( const self_type that)

Subtract an other number.

Parameters
thatThe other number.

Definition at line 229 of file real_number.tpp.

template<typename T >
claw::real_number< T >::self_type claw::real_number< T >::operator/ ( const self_type that) const

Divide by an other number.

Parameters
thatThe other number.

Definition at line 203 of file real_number.tpp.

template<typename T >
claw::real_number< T >::self_type & claw::real_number< T >::operator/= ( const self_type that)

Divide by an other number.

Parameters
thatThe other number.

Definition at line 257 of file real_number.tpp.

template<typename T >
bool claw::real_number< T >::operator< ( const self_type that) const

Tell if this number is stricty lower than an other number.

Parameters
thatThe other number.

Definition at line 83 of file real_number.tpp.

template<typename T >
bool claw::real_number< T >::operator<= ( const self_type that) const

Tell if this number is lower or equal to an other number.

Parameters
thatThe other number.

Definition at line 103 of file real_number.tpp.

template<typename T >
bool claw::real_number< T >::operator== ( const self_type that) const

Tell if this number is equal to an other number.

Parameters
thatThe other number.

Definition at line 136 of file real_number.tpp.

template<typename T >
bool claw::real_number< T >::operator> ( const self_type that) const

Tell if this number is stricty greater than an other number.

Parameters
thatThe other number.

Definition at line 114 of file real_number.tpp.

template<typename T >
bool claw::real_number< T >::operator>= ( const self_type that) const

Tell if this number is greater or equal to an other number.

Parameters
thatThe other number.

Definition at line 125 of file real_number.tpp.

template<typename T >
std::ostream & claw::real_number< T >::output ( std::ostream &  os) const

Output the value in a stream.

Parameters
osThe stream in which the value is written.

Definition at line 270 of file real_number.tpp.

Referenced by operator<<().

Friends And Related Function Documentation

template<typename T>
std::istream& operator>> ( std::istream &  is,
real_number< T > &  self 
)
friend

Read a number from a stream.

Parameters
isThe stream from which the value is read.
selfThe number.

Definition at line 339 of file real_number.tpp.


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