38 : m_value(0), m_epsilon(
make_epsilon<value_type>::value(m_value) )
50 : m_value(v), m_epsilon(
make_epsilon<T>::value(m_value) )
62 : m_value(that.m_value), m_epsilon(that.m_epsilon)
85 if ( that.m_value == std::numeric_limits<value_type>::infinity() )
86 return m_value != std::numeric_limits<value_type>::infinity();
87 else if ( that.m_value == -std::numeric_limits<value_type>::infinity() )
89 else if ( m_value == std::numeric_limits<value_type>::infinity() )
91 else if ( m_value == -std::numeric_limits<value_type>::infinity() )
92 return that.m_value != -std::numeric_limits<value_type>::infinity();
94 return m_value < (that.m_value - std::max(m_epsilon, that.m_epsilon));
105 return !(that < *
this);
127 return that <= *
this;
138 if ( that.m_value == std::numeric_limits<value_type>::infinity() )
139 return m_value == std::numeric_limits<value_type>::infinity();
140 else if ( that.m_value == -std::numeric_limits<value_type>::infinity() )
141 return m_value == -std::numeric_limits<value_type>::infinity();
142 else if ( m_value == that.m_value )
145 return std::abs(m_value - that.m_value)
146 <= std::max(m_epsilon, that.m_epsilon);
157 return !((*this) == that);
169 return self_type(m_value + that.m_value);
181 return self_type(m_value - that.m_value);
193 return self_type(m_value * that.m_value);
205 return self_type(m_value / that.m_value);
217 m_value += that.m_value;
231 m_value -= that.m_value;
245 m_value *= that.m_value;
259 m_value /= that.m_value;
272 return os << m_value;
327 std::ostream& operator<<( std::ostream& os, const claw::real_number<T>& self )
341 return is >>
self.m_value;
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.
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.