mirror of https://github.com/CGAL/cgal
fix corner case in round, where the float is representing
a power of 2 in the mantissa
This commit is contained in:
parent
7d57644b59
commit
1ab0e40c06
|
|
@ -279,11 +279,12 @@ round(const CORE::BigFloat& x, long rel_prec = CORE::defRelPrec.toLong() ){
|
|||
// else
|
||||
// std::cout <<"current prec: " << " SINGLETON " << std::endl;
|
||||
// std::cout <<"desired prec: " << rel_prec << std::endl;
|
||||
|
||||
// std::cout <<"bitLength: " << CORE::bitLength(m) << std::endl;
|
||||
// long shift = ::CORE::bitLength(m) - rel_prec - 1;
|
||||
|
||||
long shift ;
|
||||
if (err == 0)
|
||||
shift = ::CORE::bitLength(m) - rel_prec - 2;
|
||||
shift = ::CORE::bitLength(m) - rel_prec - 3;
|
||||
else
|
||||
shift = CGAL::relative_precision(x) - rel_prec -1;
|
||||
|
||||
|
|
@ -330,8 +331,9 @@ public:
|
|||
CGAL_precondition(!Singleton()(x));
|
||||
CGAL_precondition(!CGAL::zero_in(x));
|
||||
|
||||
x = x.abs();
|
||||
NT w = Width()(x);
|
||||
w /= ::CORE::BigFloat(x.m()-x.err(),0,x.exp());
|
||||
w /= ::CORE::BigFloat(x.m()-x.err(),0,x.exp());
|
||||
w = w.abs();
|
||||
return -(CORE::ceilLg(w.m()+w.err())+w.exp()*14);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue