diff options
author | Antonio Sanchez <cantonios@google.com> | 2021-02-12 11:32:29 -0800 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2021-02-17 02:23:24 +0000 |
commit | 7ff0b7a980ceffe7d0e72ebac924f514f7874e9b (patch) | |
tree | 4022a25c9e1c909aff3f43b978a4a5d5ce0a1c47 /Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h | |
parent | 9ad4096ccb75dd5c5dd882576d49d48475afa300 (diff) |
Updated pfrexp implementation.
The original implementation fails for 0, denormals, inf, and NaN.
See #2150
Diffstat (limited to 'Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h')
-rw-r--r-- | Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h index 96c572fd3..637e5f4af 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h @@ -25,29 +25,23 @@ pset(const typename unpacket_traits<Packet>::type (&a)[N] /* a */); * Some generic implementations to be used by implementors ***************************************************************************/ -/** Default implementation of pfrexp for float. +/** Default implementation of pfrexp. * It is expected to be called by implementers of template<> pfrexp. */ -template<typename Packet> EIGEN_STRONG_INLINE Packet -pfrexp_float(const Packet& a, Packet& exponent); +template<typename Packet> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC +Packet pfrexp_generic(const Packet& a, Packet& exponent); -/** Default implementation of pfrexp for double. - * It is expected to be called by implementers of template<> pfrexp. - */ -template<typename Packet> EIGEN_STRONG_INLINE Packet -pfrexp_double(const Packet& a, Packet& exponent); - -/** Default implementation of pldexp for float. - * It is expected to be called by implementers of template<> pldexp. - */ -template<typename Packet> EIGEN_STRONG_INLINE Packet -pldexp_float(const Packet& a, const Packet& exponent); +// Extracts the biased exponent value from Packet p, and casts the results to +// a floating-point Packet type. Used by pfrexp_generic. Override this if +// there is no unpacket_traits<Packet>::integer_packet. +template<typename Packet> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC +Packet pfrexp_generic_get_biased_exponent(const Packet& p); -/** Default implementation of pldexp for double. +/** Default implementation of pldexp. * It is expected to be called by implementers of template<> pldexp. */ -template<typename Packet> EIGEN_STRONG_INLINE Packet -pldexp_double(const Packet& a, const Packet& exponent); +template<typename Packet> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC +Packet pldexp_generic(const Packet& a, const Packet& exponent); /** \internal \returns log(x) for single precision float */ template <typename Packet> |