From 8525f85596eaa63f9608cddd00d757c9ab8ffe9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Tue, 22 Dec 2009 10:48:07 +0000 Subject: [PATCH] avoided warning in vc; fixed minor bug by avoiding creation of mpfr numbers with precision less than MPFR_PREC_MIN --- Number_types/include/CGAL/GMP/Gmpfr_type.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Number_types/include/CGAL/GMP/Gmpfr_type.h b/Number_types/include/CGAL/GMP/Gmpfr_type.h index ea933d93791..9714d95d414 100644 --- a/Number_types/include/CGAL/GMP/Gmpfr_type.h +++ b/Number_types/include/CGAL/GMP/Gmpfr_type.h @@ -869,12 +869,14 @@ std::pair Gmpfr::to_integer_exp()const{ CGAL_assertion(mpz_divisible_2exp_p(z.mpz(),firstone)!=0); Gmpz d(1); mpz_mul_2exp(d.mpz(),d.mpz(),firstone); - CGAL_assertion(mpz_divisible_p(z.mpz(),d.mpz())); + CGAL_assertion(mpz_divisible_p(z.mpz(),d.mpz())!=0); mpz_divexact(z.mpz(),z.mpz(),d.mpz()); e+=firstone; CGAL_assertion(mpfr_get_emax()>=e); } - CGAL_assertion_code(Gmpfr test(z,mpz_sizeinbase(z.mpz(),2));) + CGAL_assertion_code(Gmpfr::Precision_type p=mpz_sizeinbase(z.mpz(),2);) + CGAL_assertion_code(if(MPFR_PREC_MIN>p) p=MPFR_PREC_MIN;) + CGAL_assertion_code(Gmpfr test(z,p);) CGAL_assertion_code(mpfr_mul_2si(test.fr(),test.fr(),e,GMP_RNDN);) CGAL_assertion_msg(mpfr_equal_p(test.fr(),fr())!=0,"conversion error"); return std::make_pair(z,e);