diff options
author | Antonio Sanchez <cantonios@google.com> | 2021-01-20 19:00:09 -0800 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2021-01-21 19:32:28 +0000 |
commit | b2126fd6b5e232d072ceadb1abb6695ae3352e2e (patch) | |
tree | b86944d559717eeee3589efa21dcfd30cbdd2f3d /Eigen/src/Core/GenericPacketMath.h | |
parent | 25d8498f8ba29c8dc055dd56113facbdbe154345 (diff) |
Fix pfrexp/pldexp for half.
The recent addition of vectorized pow (!330) relies on `pfrexp` and
`pldexp`. This was missing for `Eigen::half` and `Eigen::bfloat16`.
Adding tests for these packet ops also exposed an issue with handling
negative values in `pfrexp`, returning an incorrect exponent.
Added the missing implementations, corrected the exponent in `pfrexp1`,
and added `packetmath` tests.
Diffstat (limited to 'Eigen/src/Core/GenericPacketMath.h')
-rw-r--r-- | Eigen/src/Core/GenericPacketMath.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index 16119c1d8..b02a9f20b 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -442,7 +442,7 @@ template <typename Packet> EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) { int exp; EIGEN_USING_STD(frexp); - Packet result = frexp(a, &exp); + Packet result = static_cast<Packet>(frexp(a, &exp)); exponent = static_cast<Packet>(exp); return result; } @@ -453,7 +453,7 @@ EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) { template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pldexp(const Packet &a, const Packet &exponent) { EIGEN_USING_STD(ldexp) - return ldexp(a, static_cast<int>(exponent)); + return static_cast<Packet>(ldexp(a, static_cast<int>(exponent))); } /** \internal \returns the min of \a a and \a b (coeff-wise) */ |