diff options
author | Gael Guennebaud <g.gael@free.fr> | 2018-04-04 13:47:23 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2018-04-04 13:47:23 +0200 |
commit | e116f6847e3cd9d16ea3be14c2b7efbd0a1c2b0b (patch) | |
tree | 30a2a845a5a479a2dec68bdfe21bc923b164028b /Eigen/src/Core/MathFunctions.h | |
parent | 73729025a4740d344bae98dfbae36a69405e217f (diff) |
bug #1521: avoid signalling NaN in hypot and make it std::complex<> friendly.
Diffstat (limited to 'Eigen/src/Core/MathFunctions.h')
-rw-r--r-- | Eigen/src/Core/MathFunctions.h | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index e981129b2..84f9d0cd5 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -347,31 +347,7 @@ struct norm1_retval * Implementation of hypot * ****************************************************************************/ -template<typename Scalar> -struct hypot_impl -{ - typedef typename NumTraits<Scalar>::Real RealScalar; - static inline RealScalar run(const Scalar& x, const Scalar& y) - { - EIGEN_USING_STD_MATH(abs); - EIGEN_USING_STD_MATH(sqrt); - RealScalar _x = abs(x); - RealScalar _y = abs(y); - Scalar p, qp; - if(_x>_y) - { - p = _x; - qp = _y / p; - } - else - { - p = _y; - qp = _x / p; - } - if(p==RealScalar(0)) return RealScalar(0); - return p * sqrt(RealScalar(1) + qp*qp); - } -}; +template<typename Scalar> struct hypot_impl; template<typename Scalar> struct hypot_retval |