Skip to content

Commit

Permalink
add assertion to make sure that the rounding mode is good prior to th…
Browse files Browse the repository at this point in the history
…e call
  • Loading branch information
sloriot committed Nov 20, 2024
1 parent 4ceec7d commit 42d435c
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 42d435c

Please sign in to comment.