aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/arch/ZVector
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2021-06-10 19:18:50 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2021-06-11 02:35:53 +0000
commitfc87e2cbaa65e7e93a2c695ce5a9dc048a64a985 (patch)
tree5660a36af91911a5f9e1b53c3de2b2622ebcce74 /Eigen/src/Core/arch/ZVector
parentf64b2954c711b7846ae6ae228c5f14bd8dd56ec4 (diff)
Use bit_cast to create -0.0 for floating point types to avoid compiler optimization changing sign with --ffast-math enabled.
Diffstat (limited to 'Eigen/src/Core/arch/ZVector')
-rwxr-xr-xEigen/src/Core/arch/ZVector/PacketMath.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Eigen/src/Core/arch/ZVector/PacketMath.h b/Eigen/src/Core/arch/ZVector/PacketMath.h
index b10c1f6c7..2246439cc 100755
--- a/Eigen/src/Core/arch/ZVector/PacketMath.h
+++ b/Eigen/src/Core/arch/ZVector/PacketMath.h
@@ -94,8 +94,9 @@ static _EIGEN_DECLARE_CONST_FAST_Packet2d(ZERO, 0);
static _EIGEN_DECLARE_CONST_FAST_Packet2l(ZERO, 0);
static _EIGEN_DECLARE_CONST_FAST_Packet2l(ONE, 1);
-static Packet2d p2d_ONE = { 1.0, 1.0 };
-static Packet2d p2d_ZERO_ = { -0.0, -0.0 };
+static Packet2d p2d_ONE = { 1.0, 1.0 };
+static Packet2d p2d_ZERO_ = { numext::bit_cast<double>0x8000000000000000ull),
+ numext::bit_cast<double>0x8000000000000000ull) };
#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)
#define _EIGEN_DECLARE_CONST_FAST_Packet4f(NAME,X) \