Addendum to bug #859: pexp(NaN) for double did not return NaN, also, plog(NaN) did not return NaN.

psqrt(NaN) and psqrt(-1) shall return NaN if EIGEN_FAST_MATH==0
This commit is contained in:
Christoph Hertzberg
2014-10-20 13:13:43 +02:00
parent aa5f79206f
commit 84aaa03182
2 changed files with 17 additions and 3 deletions

View File

@@ -52,7 +52,7 @@ Packet4f plog<Packet4f>(const Packet4f& _x)
Packet4i emm0;
Packet4f invalid_mask = _mm_cmplt_ps(x, _mm_setzero_ps());
Packet4f invalid_mask = _mm_cmpnge_ps(x, _mm_setzero_ps()); // not greater equal is true if x is NaN
Packet4f iszero_mask = _mm_cmpeq_ps(x, _mm_setzero_ps());
x = pmax(x, p4f_min_norm_pos); /* cut off denormalized stuff */
@@ -241,7 +241,7 @@ Packet2d pexp<Packet2d>(const Packet2d& _x)
emm0 = _mm_add_epi32(emm0, p4i_1023_0);
emm0 = _mm_slli_epi32(emm0, 20);
emm0 = _mm_shuffle_epi32(emm0, _MM_SHUFFLE(1,2,0,3));
return pmul(x, Packet2d(_mm_castsi128_pd(emm0)));
return pmax(pmul(x, Packet2d(_mm_castsi128_pd(emm0))), _x);
}
/* evaluation of 4 sines at onces, using SSE2 intrinsics.