Use pnegate(pzero(x)) as a generic way to generate -0.0. Some compiler do not handle the literal -0.0 properly in fastmath mode.

This commit is contained in:
Rasmus Munk Larsen 2022-10-12 01:57:05 +00:00
parent 7846c7387c
commit c0d6a72611

View File

@ -523,7 +523,7 @@ struct scalar_atan2_op {
// See https://en.cppreference.com/w/cpp/numeric/math/atan2
// for how corner cases are supposed to be handled according to the
// IEEE floating-point standard (IEC 60559).
const Packet kSignMask = pset1<Packet>(Scalar(-0.0));
const Packet kSignMask = pnegate(pzero(x));
const Packet kPi = pset1<Packet>(Scalar(EIGEN_PI));
const Packet kPiO2 = pset1<Packet>(Scalar(EIGEN_PI / 2));
const Packet kPiO4 = pset1<Packet>(Scalar(EIGEN_PI / 4));