30 #ifndef __CLAW_REAL_NUMBER_HPP__
31 #define __CLAW_REAL_NUMBER_HPP__
56 return std::abs(v) <= 1 ?
57 std::numeric_limits<T>::epsilon() :
58 std::abs(v) * std::numeric_limits<T>::epsilon();
70 std::istream& ::operator>> <>( std::istream& is,
real_number<T>& self );
81 self_type
abs()
const;
83 bool operator<(
const self_type& that )
const;
84 bool operator<=(
const self_type& that )
const;
85 bool operator>(
const self_type& that )
const;
86 bool operator>=(
const self_type& that )
const;
87 bool operator==(
const self_type& that )
const;
88 bool operator!=(
const self_type& that )
const;
90 self_type
operator+(
const self_type& that )
const;
91 self_type
operator-(
const self_type& that )
const;
92 self_type
operator*(
const self_type& that )
const;
93 self_type
operator/(
const self_type& that )
const;
95 self_type&
operator+=(
const self_type& that );
96 self_type&
operator-=(
const self_type& that );
97 self_type&
operator*=(
const self_type& that );
98 self_type&
operator/=(
const self_type& that );
100 std::ostream&
output( std::ostream& os )
const;
110 value_type m_epsilon;
118 struct numeric_limits< claw::real_number<T> >:
119 public numeric_limits<T>
136 std::ostream& operator<<( std::ostream& os, const claw::real_number<T>& self );
142 #endif // __CLAW_REAL_NUMBER_HPP__
bool operator==(const self_type &that) const
Tell if this number is equal to an other number.
self_type & operator*=(const self_type &that)
Multiply by an other number.
bool operator>(const self_type &that) const
Tell if this number is stricty greater than an other number.
Custom precision real numbers.
self_type operator*(const self_type &that) const
Multiply two numbers.
self_type & operator-=(const self_type &that)
Subtract 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)
Add an other number.
Implementation of the claw::real_number class.
self_type operator/(const self_type &that) const
Divide by an other number.
This class generates an epsilon value of a given precision.
bool operator<=(const self_type &that) const
Tell if this number is lower or equal to an other number.
std::ostream & output(std::ostream &os) const
Output the value in a stream.
std::istream & operator>>(std::istream &is, claw::real_number< T > &self)
Read a number from a stream.
self_type operator-(const self_type &that) const
Get the difference of two numbers.
bool operator<(const self_type &that) const
Tell if this number is stricty lower than an other number.
real_number()
Constructuor.
bool operator>=(const self_type &that) const
Tell if this number is greater or equal to an other number.
self_type abs() const
Get the absolute value of the number.
self_type & operator/=(const self_type &that)
Divide by an other number.
self_type operator+(const self_type &that) const
Sum two numbers.