Skip to content

Commit

Permalink
Remove extra rounding mode changes for sqrt for interval (#8611)
Browse files Browse the repository at this point in the history
The only place where the function is call is in `Interval_nt::sqrt()`
and that functions start with the creation of a protector.
Even worse, if we are using interval with no protection, we get an
incorrect rounding mode after a call to sqrt.
  • Loading branch information
sloriot authored Dec 4, 2024
2 parents 98c9444 + 42d435c commit 91b3f7c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Number_types/include/CGAL/FPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ inline double IA_sqrt_toward_zero(double d) {
#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST
return (d > 0.0) ? nextafter(std::sqrt(d), 0.) : 0.0;
#else
CGAL_assertion(FPU_get_cw()==CGAL_FE_UPWARD);
FPU_set_cw(CGAL_FE_DOWNWARD);
double i = (d > 0.0) ? CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(d))) : 0.0;
FPU_set_cw(CGAL_FE_UPWARD);
Expand Down

0 comments on commit 91b3f7c

Please sign in to comment.