diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index b0c401a3797..1a511325de9 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -438,6 +438,69 @@ public : return *this = new Lazy_exact_Div(*this, b); } + // Mixed comparisons with int. + friend bool operator<(const Lazy_exact_nt& a, int b) + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + Uncertain res = a.approx() < b; + if (is_certain(res)) + return res; + CGAL_BRANCH_PROFILER_BRANCH(tmp); + return a.exact() < b; + } + + friend bool operator>(const Lazy_exact_nt& a, int b) + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + Uncertain res = b < a.approx(); + if (is_certain(res)) + return get_certain(res); + CGAL_BRANCH_PROFILER_BRANCH(tmp); + return b < a.exact(); + } + + friend bool operator==(const Lazy_exact_nt& a, int b) + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + Uncertain res = b == a.approx(); + if (is_certain(res)) + return get_certain(res); + CGAL_BRANCH_PROFILER_BRANCH(tmp); + return b == a.exact(); + } + + + // Mixed comparisons with double. + friend bool operator<(const Lazy_exact_nt& a, double b) + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + Uncertain res = a.approx() < b; + if (is_certain(res)) + return res; + CGAL_BRANCH_PROFILER_BRANCH(tmp); + return a.exact() < b; + } + + friend bool operator>(const Lazy_exact_nt& a, double b) + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + Uncertain res = b < a.approx(); + if (is_certain(res)) + return res; + CGAL_BRANCH_PROFILER_BRANCH(tmp); + return b < a.exact(); + } + + friend bool operator==(const Lazy_exact_nt& a, double b) + { + CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); + Uncertain res = b == a.approx(); + if (is_certain(res)) + return res; + CGAL_BRANCH_PROFILER_BRANCH(tmp); + return b == a.exact(); + } + // % kills filtering Self & operator%=(const Self& b) { @@ -562,84 +625,6 @@ operator%(const Lazy_exact_nt& a, const Lazy_exact_nt& b) } - -// Mixed operators with int. -template -bool -operator<(const Lazy_exact_nt& a, int b) -{ - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - Uncertain res = a.approx() < b; - if (is_certain(res)) - return res; - CGAL_BRANCH_PROFILER_BRANCH(tmp); - return a.exact() < b; -} - -template -bool -operator>(const Lazy_exact_nt& a, int b) -{ - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - Uncertain res = b < a.approx(); - if (is_certain(res)) - return get_certain(res); - CGAL_BRANCH_PROFILER_BRANCH(tmp); - return b < a.exact(); -} - -template -bool -operator==(const Lazy_exact_nt& a, int b) -{ - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - Uncertain res = b == a.approx(); - if (is_certain(res)) - return get_certain(res); - CGAL_BRANCH_PROFILER_BRANCH(tmp); - return b == a.exact(); -} - - -// Mixed operators with double. -template -bool -operator<(const Lazy_exact_nt& a, double b) -{ - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - Uncertain res = a.approx() < b; - if (is_certain(res)) - return res; - CGAL_BRANCH_PROFILER_BRANCH(tmp); - return a.exact() < b; -} - -template -bool -operator>(const Lazy_exact_nt& a, double b) -{ - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - Uncertain res = b < a.approx(); - if (is_certain(res)) - return res; - CGAL_BRANCH_PROFILER_BRANCH(tmp); - return b < a.exact(); -} - -template -bool -operator==(const Lazy_exact_nt& a, double b) -{ - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - Uncertain res = b == a.approx(); - if (is_certain(res)) - return res; - CGAL_BRANCH_PROFILER_BRANCH(tmp); - return b == a.exact(); -} - - - template Lazy_exact_nt< typename Coercion_traits::Type > operator+(const Lazy_exact_nt& a, const Lazy_exact_nt& b)