From 5f3912d2db575d195f2d65b701eaec0eb326c630 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Fri, 11 Jan 2019 16:37:55 +0100 Subject: [PATCH] Negate the lower bound before taking its square root. --- Number_types/include/CGAL/Interval_nt.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Number_types/include/CGAL/Interval_nt.h b/Number_types/include/CGAL/Interval_nt.h index bff07867b2f..6371097f110 100644 --- a/Number_types/include/CGAL/Interval_nt.h +++ b/Number_types/include/CGAL/Interval_nt.h @@ -1101,10 +1101,12 @@ namespace INTERN_INTERVAL_NT { double i = 0; if(d.inf() > 0){ __m128d x = d.simd(); + __m128d m = _mm_set_sd(-0.); + __m128d y = _mm_xor_pd(x, m); // We don't opacify because hopefully a rounded operation is explicit // enough that compilers won't mess with it, and it does not care about // fesetround. - __m128d vr = _mm_sqrt_round_sd(x, x, _MM_FROUND_TO_NEG_INF|_MM_FROUND_NO_EXC); + __m128d vr = _mm_sqrt_round_sd(y, y, _MM_FROUND_TO_NEG_INF|_MM_FROUND_NO_EXC); i = _mm_cvtsd_f64(vr); // We could compute the sqrt of d.sup() using _mm_sqrt_pd (same speed as // _sd except on broadwell) so it is already in the high part and we can