diff --git a/include/boost/geometry/extensions/contrib/ttmath_stub.hpp b/include/boost/geometry/extensions/contrib/ttmath_stub.hpp index cb53fc114..91ef63eb1 100644 --- a/include/boost/geometry/extensions/contrib/ttmath_stub.hpp +++ b/include/boost/geometry/extensions/contrib/ttmath_stub.hpp @@ -175,6 +175,39 @@ inline ttmath_big operator/(ttmath_big const& x, ttmath_big const& y) } +// math functions for ttmath_big + +#define TTMATH_BIG_UNARY_MATH_FUNCTION(FCT) \ + ttmath_big FCT(ttmath_big const& x) \ + { \ + return ttmath::FCT(static_cast const&>(x)); \ + } + +#define TTMATH_BIG_BINARY_MATH_FUNCTION(FCT) \ + ttmath_big FCT(ttmath_big const& x, ttmath_big const& y) \ + { \ + return ttmath::FCT(static_cast const&>(x), \ + static_cast const&>(y)); \ + } + +TTMATH_BIG_UNARY_MATH_FUNCTION(sqrt) +TTMATH_BIG_UNARY_MATH_FUNCTION(abs) +TTMATH_BIG_UNARY_MATH_FUNCTION(ceil) +TTMATH_BIG_UNARY_MATH_FUNCTION(floor) +TTMATH_BIG_UNARY_MATH_FUNCTION(asin) +TTMATH_BIG_UNARY_MATH_FUNCTION(acos) +TTMATH_BIG_UNARY_MATH_FUNCTION(atan) +TTMATH_BIG_UNARY_MATH_FUNCTION(sin) +TTMATH_BIG_UNARY_MATH_FUNCTION(cos) +TTMATH_BIG_UNARY_MATH_FUNCTION(tan) + +TTMATH_BIG_BINARY_MATH_FUNCTION(atan2) +TTMATH_BIG_BINARY_MATH_FUNCTION(mod) + +#undef TTMATH_BIG_UNARY_MATH_FUNCTION +#undef TTMATH_BIG_BINARY_MATH_FUNCTION + + namespace boost{ namespace geometry { namespace math { @@ -235,6 +268,7 @@ namespace detail : public define_two_pi > {}; + template struct equals_with_epsilon, false> { @@ -252,6 +286,33 @@ namespace detail : public equals_with_epsilon, false> {}; + template + struct equals, false> + { + template + static inline bool apply(ttmath::Big const& a, + ttmath::Big const& b, + Policy const&) + { + return equals_with_epsilon + < + ttmath::Big + >::apply(a, b); + } + }; + + template <> + struct equals + { + template + static inline bool apply(ttmath_big const& a, + ttmath_big const& b, + Policy const&) + { + return equals_with_epsilon::apply(a, b); + } + }; + } // detail } // ttmath