mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Use bit_cast to create -0.0 for floating point types to avoid compiler optimization changing sign with --ffast-math enabled.
(cherry picked from commit fc87e2cbaa)
This commit is contained in:
@@ -146,8 +146,9 @@ struct quat_conj<Architecture::Target, Derived, double>
|
||||
{
|
||||
evaluator<typename Derived::Coefficients> qe(q.coeffs());
|
||||
Quaternion<double> res;
|
||||
double arr1[2] = {-0.0, -0.0};
|
||||
double arr2[2] = {-0.0, 0.0};
|
||||
const double neg_zero = numext::bit_cast<double>(0x8000000000000000ull);
|
||||
double arr1[2] = {neg_zero, neg_zero};
|
||||
double arr2[2] = {neg_zero, 0.0};
|
||||
const Packet2d mask0 = pset<Packet2d>(arr1);
|
||||
const Packet2d mask2 = pset<Packet2d>(arr2);
|
||||
pstoret<double,Packet2d,ResAlignment>(&res.x(), pxor(mask0, qe.template packet<traits<Derived>::Alignment,Packet2d>(0)));
|
||||
|
||||
Reference in New Issue
Block a user