Negate the lower bound before taking its square root.

This commit is contained in:
Marc Glisse 2019-01-11 16:37:55 +01:00
parent 672f456b64
commit 5f3912d2db
1 changed files with 3 additions and 1 deletions

View File

@ -1101,10 +1101,12 @@ namespace INTERN_INTERVAL_NT {
double i = 0; double i = 0;
if(d.inf() > 0){ if(d.inf() > 0){
__m128d x = d.simd(); __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 // 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 // enough that compilers won't mess with it, and it does not care about
// fesetround. // 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); i = _mm_cvtsd_f64(vr);
// We could compute the sqrt of d.sup() using _mm_sqrt_pd (same speed as // 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 // _sd except on broadwell) so it is already in the high part and we can