mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-13 18:03:13 +08:00
Fix warning due to missing cast for exponent arguments for std::frexp and std::lexp.
This commit is contained in:
parent
2df57be856
commit
5a3ebda36b
@ -244,14 +244,19 @@ pshiftleft(const long int& a) { return a << N; }
|
|||||||
/** \internal \returns the significant and exponent of the underlying floating point numbers
|
/** \internal \returns the significant and exponent of the underlying floating point numbers
|
||||||
* See https://en.cppreference.com/w/cpp/numeric/math/frexp
|
* See https://en.cppreference.com/w/cpp/numeric/math/frexp
|
||||||
*/
|
*/
|
||||||
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
|
template <typename Packet>
|
||||||
pfrexp(const Packet &a, Packet &exponent) { return std::frexp(a,&exponent); }
|
EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) {
|
||||||
|
int exp;
|
||||||
|
Packet result = std::frexp(a, &exp);
|
||||||
|
exponent = static_cast<Packet>(exp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/** \internal \returns a * 2^exponent
|
/** \internal \returns a * 2^exponent
|
||||||
* See https://en.cppreference.com/w/cpp/numeric/math/ldexp
|
* See https://en.cppreference.com/w/cpp/numeric/math/ldexp
|
||||||
*/
|
*/
|
||||||
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
|
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
|
||||||
pldexp(const Packet &a, const Packet &exponent) { return std::ldexp(a,exponent); }
|
pldexp(const Packet &a, const Packet &exponent) { return std::ldexp(a, static_cast<int>(exponent)); }
|
||||||
|
|
||||||
/** \internal \returns zeros */
|
/** \internal \returns zeros */
|
||||||
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
|
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
|
||||||
@ -259,7 +264,7 @@ pzero(const Packet& a) { return pxor(a,a); }
|
|||||||
|
|
||||||
template<> EIGEN_DEVICE_FUNC inline float pzero<float>(const float& a) {
|
template<> EIGEN_DEVICE_FUNC inline float pzero<float>(const float& a) {
|
||||||
EIGEN_UNUSED_VARIABLE(a);
|
EIGEN_UNUSED_VARIABLE(a);
|
||||||
return 0.;
|
return 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> EIGEN_DEVICE_FUNC inline double pzero<double>(const double& a) {
|
template<> EIGEN_DEVICE_FUNC inline double pzero<double>(const double& a) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user