diff --git a/Modular_arithmetic/examples/Modular_arithmetic/modular_filter.cpp b/Modular_arithmetic/examples/Modular_arithmetic/modular_filter.cpp index 08db0b84eff..03ee2c65d98 100644 --- a/Modular_arithmetic/examples/Modular_arithmetic/modular_filter.cpp +++ b/Modular_arithmetic/examples/Modular_arithmetic/modular_filter.cpp @@ -77,6 +77,8 @@ Polynomial modular_filtered_gcd(const Polynomial& p1, const Polynomial& p2){ } int main(){ + // Enforce IEEE double precision (on i386/Windows) + CGAL::Protect_FPU_rounding pfr(CGAL_FE_TONEAREST); CGAL::set_pretty_mode(std::cout); typedef CGAL::Gmpz NT; diff --git a/Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h b/Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h index ddd0859661d..793c8b8166f 100644 --- a/Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h +++ b/Modular_arithmetic/include/CGAL/Modular_arithmetic/Residue_type.h @@ -32,20 +32,7 @@ CGAL_BEGIN_NAMESPACE -// fwd -void force_ieee_double_precision(); -#ifdef CGAL_HAS_THREADS -#else - -namespace CGALi{ -struct Modular_arithmetic_needs_ieee_double_precision{ - Modular_arithmetic_needs_ieee_double_precision(){ - CGAL::force_ieee_double_precision(); - } -}; -} // namespace CGALi -#endif class Residue; @@ -89,7 +76,6 @@ private: prime_int_.reset(new int(67111067)); prime_.reset(new double(67111067.0)); prime_inv_.reset(new double(1.0/67111067.0)); - CGAL::force_ieee_double_precision(); } static inline int get_prime_int(){ @@ -116,9 +102,6 @@ private: static int get_prime_int(){ return prime_int;} static double get_prime() { return prime;} static double get_prime_inv(){ return prime_inv;} - // calls force_ieee_double_precision(); within constructor - static const CGALi::Modular_arithmetic_needs_ieee_double_precision - modular_arithmetic_needs_ieee_double_precision; #endif /* Quick integer rounding, valid if a<2^51. for double */ diff --git a/Modular_arithmetic/src/CGAL/Residue_type.cpp b/Modular_arithmetic/src/CGAL/Residue_type.cpp index f55bc306e4f..a81bb816539 100644 --- a/Modular_arithmetic/src/CGAL/Residue_type.cpp +++ b/Modular_arithmetic/src/CGAL/Residue_type.cpp @@ -29,9 +29,7 @@ boost::thread_specific_ptr Residue::prime_inv_; int Residue::prime_int = 67111067; double Residue::prime = 67111067.0; double Residue::prime_inv =1/67111067.0; -const CGALi::Modular_arithmetic_needs_ieee_double_precision -Residue::modular_arithmetic_needs_ieee_double_precision -= CGALi::Modular_arithmetic_needs_ieee_double_precision(); + #endif const double Residue::CST_CUT = std::ldexp( 3., 51 ); diff --git a/Modular_arithmetic/test/Modular_arithmetic/Residue.cpp b/Modular_arithmetic/test/Modular_arithmetic/Residue.cpp index d03cbcdd9e3..3cf23166528 100644 --- a/Modular_arithmetic/test/Modular_arithmetic/Residue.cpp +++ b/Modular_arithmetic/test/Modular_arithmetic/Residue.cpp @@ -13,7 +13,9 @@ #include int main() -{ +{ + // Enforce IEEE double precision (on i386/Windows) + CGAL::Protect_FPU_rounding pfr(CGAL_FE_TONEAREST); typedef CGAL::Residue NT; typedef CGAL::Field_tag Tag; typedef CGAL::Tag_true Is_exact;