mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-13 01:43:13 +08:00
Fix pexp test for ARM.
This commit is contained in:
parent
6da34d9d9e
commit
17f3bf8985
@ -1346,13 +1346,25 @@ struct exp_complex_test_impl {
|
|||||||
static Scalar cis(const RealScalar& x) { return Scalar(numext::cos(x), numext::sin(x)); }
|
static Scalar cis(const RealScalar& x) { return Scalar(numext::cos(x), numext::sin(x)); }
|
||||||
|
|
||||||
// Verify equality with signed zero.
|
// Verify equality with signed zero.
|
||||||
static bool is_exactly_equal(const RealScalar& a, const RealScalar& b) {
|
static bool is_exactly_equal(RealScalar a, RealScalar b) {
|
||||||
// NaNs are always unsigned, and always compare not equal directly.
|
// NaNs are always unsigned, and always compare not equal directly.
|
||||||
if ((numext::isnan)(a)) {
|
if ((numext::isnan)(a)) {
|
||||||
return (numext::isnan)(b);
|
return (numext::isnan)(b);
|
||||||
}
|
}
|
||||||
// Signed zero.
|
|
||||||
RealScalar zero(0);
|
RealScalar zero(0);
|
||||||
|
#ifdef EIGEN_ARCH_ARM
|
||||||
|
// ARM automatically flushes denormals to zero.
|
||||||
|
// Preserve sign by multiplying by +0.
|
||||||
|
if (numext::abs(a) < (std::numeric_limits<RealScalar>::min)()) {
|
||||||
|
a = a * zero;
|
||||||
|
}
|
||||||
|
if (numext::abs(b) < (std::numeric_limits<RealScalar>::min)()) {
|
||||||
|
b = b * zero;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Signed zero.
|
||||||
if (a == zero) {
|
if (a == zero) {
|
||||||
// Signs are either 0 or NaN, so verify that their comparisons to zero are equal.
|
// Signs are either 0 or NaN, so verify that their comparisons to zero are equal.
|
||||||
return (a == b) && ((numext::signbit(a) == zero) == (numext::signbit(b) == zero));
|
return (a == b) && ((numext::signbit(a) == zero) == (numext::signbit(b) == zero));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user