mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 17:33:15 +08:00
Add a note regarding gcc bug #72867
This commit is contained in:
parent
4b377715d7
commit
66cbabafed
@ -29,8 +29,12 @@ T generic_fast_tanh_float(const T& a_x)
|
|||||||
// this range is +/-1.0f in single-precision.
|
// this range is +/-1.0f in single-precision.
|
||||||
const T plus_9 = pset1<T>(9.f);
|
const T plus_9 = pset1<T>(9.f);
|
||||||
const T minus_9 = pset1<T>(-9.f);
|
const T minus_9 = pset1<T>(-9.f);
|
||||||
|
// NOTE GCC prior to 6.3 might improperly optimize this max/min
|
||||||
|
// step such that if a_x is nan, x will be either 9 or -9,
|
||||||
|
// and tanh will return 1 or -1 instead of nan.
|
||||||
|
// This is supposed to be fixed in gcc6.3,
|
||||||
|
// see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867
|
||||||
const T x = pmax(minus_9,pmin(plus_9,a_x));
|
const T x = pmax(minus_9,pmin(plus_9,a_x));
|
||||||
|
|
||||||
// The monomial coefficients of the numerator polynomial (odd).
|
// The monomial coefficients of the numerator polynomial (odd).
|
||||||
const T alpha_1 = pset1<T>(4.89352455891786e-03f);
|
const T alpha_1 = pset1<T>(4.89352455891786e-03f);
|
||||||
const T alpha_3 = pset1<T>(6.37261928875436e-04f);
|
const T alpha_3 = pset1<T>(6.37261928875436e-04f);
|
||||||
|
@ -365,6 +365,7 @@ template<typename Scalar> void packetmath_real()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PacketTraits::HasTanh) {
|
if (PacketTraits::HasTanh) {
|
||||||
|
// NOTE this test migh fail with GCC prior to 6.3, see MathFunctionsImpl.h for details.
|
||||||
data1[0] = std::numeric_limits<Scalar>::quiet_NaN();
|
data1[0] = std::numeric_limits<Scalar>::quiet_NaN();
|
||||||
packet_helper<internal::packet_traits<Scalar>::HasTanh,Packet> h;
|
packet_helper<internal::packet_traits<Scalar>::HasTanh,Packet> h;
|
||||||
h.store(data2, internal::ptanh(h.load(data1)));
|
h.store(data2, internal::ptanh(h.load(data1)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user