24#ifndef quantlib_comparison_hpp
25#define quantlib_comparison_hpp
68 Real diff = std::fabs(x-
y);
71 if (x == 0.0 ||
y == 0.0)
72 return diff < (tolerance * tolerance);
74 return diff <= tolerance*std::fabs(x) &&
75 diff <= tolerance*std::fabs(
y);
85 if (x == 0.0 ||
y == 0.0)
86 return diff < (tolerance * tolerance);
88 return diff <= tolerance*std::fabs(x) &&
89 diff <= tolerance*std::fabs(
y);
99 Real diff = std::fabs(x-
y);
102 if (x == 0.0 ||
y == 0.0)
103 return diff < (tolerance * tolerance);
105 return diff <= tolerance*std::fabs(x) ||
106 diff <= tolerance*std::fabs(
y);
116 if (x == 0.0 ||
y == 0.0)
117 return diff < (tolerance * tolerance);
119 return diff <= tolerance*std::fabs(x) ||
120 diff <= tolerance*std::fabs(
y);
137 const ext::shared_ptr<T>&
y)
const {
std::size_t Size
size of a container
bool close(const Quantity &m1, const Quantity &m2, Size n)
bool close_enough(const Quantity &m1, const Quantity &m2, Size n)
Maps shared_ptr to either the boost or std implementation.
bool operator()(const ext::shared_ptr< T > &x, const ext::shared_ptr< T > &y) const
compare two objects by date