From fc87e2cbaa65e7e93a2c695ce5a9dc048a64a985 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Thu, 10 Jun 2021 19:18:50 -0700 Subject: Use bit_cast to create -0.0 for floating point types to avoid compiler optimization changing sign with --ffast-math enabled. --- Eigen/src/Geometry/arch/Geometry_SIMD.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Eigen/src/Geometry') diff --git a/Eigen/src/Geometry/arch/Geometry_SIMD.h b/Eigen/src/Geometry/arch/Geometry_SIMD.h index 9c15bfb98..89ac92062 100644 --- a/Eigen/src/Geometry/arch/Geometry_SIMD.h +++ b/Eigen/src/Geometry/arch/Geometry_SIMD.h @@ -146,8 +146,9 @@ struct quat_conj { evaluator qe(q.coeffs()); Quaternion res; - double arr1[2] = {-0.0, -0.0}; - double arr2[2] = {-0.0, 0.0}; + const double neg_zero = numext::bit_cast(0x8000000000000000ull); + double arr1[2] = {neg_zero, neg_zero}; + double arr2[2] = {neg_zero, 0.0}; const Packet2d mask0 = pset(arr1); const Packet2d mask2 = pset(arr2); pstoret(&res.x(), pxor(mask0, qe.template packet::Alignment,Packet2d>(0))); -- cgit v1.2.3