Go to the documentation of this file.
3 #ifndef DUNE_COMMON_FLOAT_CMP_HH
4 #define DUNE_COMMON_FLOAT_CMP_HH
127 template<
class T>
struct EpsilonType;
135 template<
class T, CmpStyle style = defaultCmpStyle>
155 bool eq(
const T &first,
168 bool ne(
const T &first,
184 bool gt(
const T &first,
200 bool lt(
const T &first,
216 bool ge(
const T &first,
232 bool le(
const T &first,
385 #endif //DUNE_COMMON_FLOAT_CMP_HH
EpsilonType epsilon() const
return the current epsilon
Definition: float_cmp.cc:425
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:147
@ downward
round toward
Definition: float_cmp.hh:120
@ defaultRoundingStyle
the global default rounding style (toward_zero)
Definition: float_cmp.hh:124
bool ge(const ValueType &first, const ValueType &second) const
test if first greater or equal second
Definition: float_cmp.cc:468
T Type
The epsilon type corresponding to value type T.
Definition: float_cmp.cc:23
static EpsilonType< T >::Type value()
Returns the default epsilon for the given value type and compare style.
@ upward
round toward
Definition: float_cmp.hh:122
Dune namespace.
Definition: alignedallocator.hh:9
I trunc(const T &val, typename EpsilonType< T >::Type epsilon)
truncate using epsilon
Definition: float_cmp.cc:396
@ relativeWeak
|a-b|/|a| <= epsilon || |a-b|/|b| <= epsilon
Definition: float_cmp.hh:104
T ValueType
Type of the values to compare.
Definition: float_cmp.hh:297
I trunc(const ValueType &val) const
truncate using epsilon
Definition: float_cmp.cc:492
bool eq(const ValueType &first, const ValueType &second) const
test for equality using epsilon
Definition: float_cmp.cc:440
bool le(const ValueType &first, const ValueType &second) const
test if first lesser or equal second
Definition: float_cmp.cc:475
RoundingStyle
Definition: float_cmp.hh:114
@ absolute
|a-b| <= epsilon
Definition: float_cmp.hh:108
static const CmpStyle cstyle
How comparisons are done.
Definition: float_cmp.hh:293
CmpStyle
Definition: float_cmp.hh:102
bool lt(const ValueType &first, const ValueType &second) const
test if first lesser than second
Definition: float_cmp.cc:461
static const RoundingStyle rstyle
How rounding is done.
Definition: float_cmp.hh:295
bool gt(const ValueType &first, const ValueType &second) const
test if first greater than second
Definition: float_cmp.cc:454
mapping from a value type and a compare style to a default epsilon
Definition: float_cmp.hh:136
@ defaultCmpStyle
the global default compare style (relative_weak)
Definition: float_cmp.hh:110
@ towardInf
always round away from 0
Definition: float_cmp.hh:118
bool eq(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test for equality using epsilon
Definition: float_cmp.cc:133
FloatCmpOps(EpsilonType epsilon=DefaultEpsilon::value())
construct an operations object
Definition: float_cmp.cc:420
FloatCmp::EpsilonType< T >::Type EpsilonType
Type of the epsilon.
Definition: float_cmp.hh:302
bool ge(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater or equal second
Definition: float_cmp.cc:161
@ towardZero
always round toward 0
Definition: float_cmp.hh:116
bool lt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first lesser than second
Definition: float_cmp.cc:154
bool ne(const ValueType &first, const ValueType &second) const
test for inequality using epsilon
Definition: float_cmp.cc:447
I round(const ValueType &val) const
round using epsilon
Definition: float_cmp.cc:484
bool le(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first lesser or equal second
Definition: float_cmp.cc:168
@ relativeStrong
|a-b|/|a| <= epsilon && |a-b|/|b| <= epsilon
Definition: float_cmp.hh:106
I round(const T &val, typename EpsilonType< T >::Type epsilon)
round using epsilon
Definition: float_cmp.cc:300
Class encapsulating a default epsilon.
Definition: float_cmp.hh:286
bool ne(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test for inequality using epsilon
Definition: float_cmp.cc:140