mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-07 03:39:04 +08:00
fix double-promotion/float-conversion in Core/SpecialFunctions.h
This commit is contained in:
parent
75a94b9662
commit
be78aea6b3
@ -284,7 +284,7 @@ struct digamma_impl {
|
|||||||
bool negative = false;
|
bool negative = false;
|
||||||
|
|
||||||
const Scalar maxnum = NumTraits<Scalar>::infinity();
|
const Scalar maxnum = NumTraits<Scalar>::infinity();
|
||||||
const Scalar m_pi(EIGEN_PI);
|
const Scalar m_pi = Scalar(EIGEN_PI);
|
||||||
|
|
||||||
const Scalar zero = Scalar(0);
|
const Scalar zero = Scalar(0);
|
||||||
const Scalar one = Scalar(1);
|
const Scalar one = Scalar(1);
|
||||||
@ -441,7 +441,7 @@ struct igamma_helper<float> {
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static EIGEN_STRONG_INLINE float big() {
|
static EIGEN_STRONG_INLINE float big() {
|
||||||
// use epsneg (1.0 - epsneg == 1.0)
|
// use epsneg (1.0 - epsneg == 1.0)
|
||||||
return 1.0 / (NumTraits<float>::epsilon() / 2);
|
return 1.0f / (NumTraits<float>::epsilon() / 2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -742,7 +742,7 @@ struct igamma_impl {
|
|||||||
const Scalar machep = igamma_helper<Scalar>::machep();
|
const Scalar machep = igamma_helper<Scalar>::machep();
|
||||||
const Scalar maxlog = numext::log(NumTraits<Scalar>::highest());
|
const Scalar maxlog = numext::log(NumTraits<Scalar>::highest());
|
||||||
|
|
||||||
double ans, ax, c, r;
|
Scalar ans, ax, c, r;
|
||||||
|
|
||||||
/* Compute x**a * exp(-x) / gamma(a) */
|
/* Compute x**a * exp(-x) / gamma(a) */
|
||||||
ax = a * numext::log(x) - x - lgamma_impl<Scalar>::run(a);
|
ax = a * numext::log(x) - x - lgamma_impl<Scalar>::run(a);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user