aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/functors
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-09-14 17:34:54 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-09-14 17:34:54 +0200
commit749b56f6af4f712ccc4235a4faf7c13e09b9f3a3 (patch)
treebf77d6d609fee4e8dcf3b354582906502a4b1b90 /Eigen/src/Core/functors
parentaf9c9f7706bb7701a7224827e981ecc2f3bd9ac7 (diff)
parent9452eb38f812194a676edc1b9eb9d08b7bc0f297 (diff)
merge with default branch
Diffstat (limited to 'Eigen/src/Core/functors')
-rw-r--r--Eigen/src/Core/functors/BinaryFunctors.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/Eigen/src/Core/functors/BinaryFunctors.h b/Eigen/src/Core/functors/BinaryFunctors.h
index ba094f5d1..157d075a7 100644
--- a/Eigen/src/Core/functors/BinaryFunctors.h
+++ b/Eigen/src/Core/functors/BinaryFunctors.h
@@ -167,9 +167,17 @@ template<typename Scalar> struct scalar_hypot_op {
EIGEN_USING_STD_MATH(max);
EIGEN_USING_STD_MATH(min);
using std::sqrt;
- Scalar p = (max)(_x, _y);
- Scalar q = (min)(_x, _y);
- Scalar qp = q/p;
+ Scalar p, qp;
+ if(_x>_y)
+ {
+ p = _x;
+ qp = _y / p;
+ }
+ else
+ {
+ p = _y;
+ qp = _x / p;
+ }
return p * sqrt(Scalar(1) + qp*qp);
}
};