From 1ca243eaa37f99b3fc6e354705746e379db685e6 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 18 Aug 2010 13:48:03 +0000 Subject: [PATCH] Merge: | ------------------------------------------------------------------------ | r58141 | lrineau | 2010-08-18 15:08:04 +0200 (Wed, 18 Aug 2010) | 5 lines | Changed paths: | M /branches/CGAL-3.7-branch/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Float_traits.h | M /branches/CGAL-3.7-branch/Number_types/include/CGAL/CORE_BigFloat.h | | Fix the "bug" of CORE-1.7 in 64 bits. The bug was actually in CGAL | Number_types and Algebraic_kernel_d! The basis of CORE::BigFloat is not | 2^14: it is 2^CORE::CHUNK_BIT. CORE::CHUNK_BIT is 14 in 32 bits, but *30* | in 64 bits! | | ------------------------------------------------------------------------ Update: See revision 58145. -- Laurent Rineau Wed Aug 18 16:26:15 CEST 2010 --- .../include/CGAL/Algebraic_kernel_d/Float_traits.h | 2 +- Number_types/include/CGAL/CORE_BigFloat.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Float_traits.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Float_traits.h index ba1c4d69cda..19a0cd44371 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Float_traits.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Float_traits.h @@ -106,7 +106,7 @@ public: struct Get_exponent : public std::unary_function< CORE::BigFloat, long > { long operator()( const CORE::BigFloat& x ) const { - return 14*x.exp(); // The basis is 8092 + return CORE::CHUNK_BIT*x.exp(); // The basis is 2^CORE::CHUNK_BIT } }; diff --git a/Number_types/include/CGAL/CORE_BigFloat.h b/Number_types/include/CGAL/CORE_BigFloat.h index 703f5dce00c..06a0f16d71d 100644 --- a/Number_types/include/CGAL/CORE_BigFloat.h +++ b/Number_types/include/CGAL/CORE_BigFloat.h @@ -191,7 +191,7 @@ public: long shift = ::CORE::bitLength(err.m()) - digits_long + 1 ; //std::cout << "shift " << shift<< std::endl; long new_err = ((err.m()+err.err()) >> shift).longValue()+1; - err = CORE::BigFloat(0,new_err,0) * CORE::BigFloat::exp2(err.exp()*14+shift); + err = CORE::BigFloat(0,new_err,0) * CORE::BigFloat::exp2(err.exp()*CORE::CHUNK_BIT+shift); }else{ err = CORE::BigFloat(0,err.m().longValue()+err.err(),err.exp()); } @@ -203,8 +203,8 @@ public: if(mid.exp() > err.exp()) { long mid_err = mid.err(); CORE::BigInt mid_m = mid.m(); - mid_err = mid_err << (mid.exp()-err.exp())*14; - mid_m = mid_m << (mid.exp()-err.exp())*14; + mid_err = mid_err << (mid.exp()-err.exp())*CORE::CHUNK_BIT; + mid_m = mid_m << (mid.exp()-err.exp())*CORE::CHUNK_BIT; mid = CORE::BigFloat(mid_m,mid_err,err.exp()); //print_bf(mid,"corr_mid"); } @@ -273,7 +273,7 @@ round(const CORE::BigFloat& x, long rel_prec = CORE::defRelPrec.toLong() ){ long exp = x.exp(); -// std::cout <<"(" << m << "+-" < 0 ){ m >>= shift ; err >>= shift; - xr = BF(m,err+1,0)*BF::exp2(exp*14+shift); + xr = BF(m,err+1,0)*BF::exp2(exp*CORE::CHUNK_BIT+shift); }else{ // noting to do xr = x; } -// std::cout <<"(" <