diff options
author | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2014-10-20 13:13:43 +0200 |
---|---|---|
committer | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2014-10-20 13:13:43 +0200 |
commit | 84aaa03182f6e31fa251d93730d628975c44207c (patch) | |
tree | 0581bd83d36b1c08e2e032e44ac85e07714b5287 /test | |
parent | aa5f79206fb632d141c3555338f89f59d1bb4633 (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/packetmath.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/packetmath.cpp b/test/packetmath.cpp index a4166d868..ee0502f69 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -311,8 +311,22 @@ template<typename Scalar> void packetmath_real() } if(internal::random<float>(0,1)<0.1) data1[internal::random<int>(0, PacketSize)] = 0; - CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasLog, std::log, internal::plog); CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasSqrt, std::sqrt, internal::psqrt); + CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasLog, std::log, internal::plog); + { + data1[0] = std::numeric_limits<Scalar>::quiet_NaN(); + packet_helper<internal::packet_traits<Scalar>::HasLog,Packet> h; + h.store(data2, internal::plog(h.load(data1))); + VERIFY(isNaN(data2[0])); + data1[0] = -1.0f; + h.store(data2, internal::plog(h.load(data1))); + VERIFY(isNaN(data2[0])); +#if !EIGEN_FAST_MATH + h.store(data2, internal::psqrt(h.load(data1))); + VERIFY(isNaN(data2[0])); + VERIFY(isNaN(data2[1])); +#endif + } } template<typename Scalar> void packetmath_notcomplex() |