From 97c9e3c74f9dd9f33f3f1699801aed0c7dfbafb4 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Sat, 9 Mar 2013 16:58:05 +0000 Subject: [PATCH] Handle special case in atanh2(x,y) when y = 0. This fixes matrix_power unit test on clang. --- Eigen/src/Core/MathFunctions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index fab2d9a72..a2c55f255 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -396,7 +396,7 @@ struct atanh2_default_impl using std::log; using std::sqrt; Scalar z = x / y; - if (abs(z) > sqrt(NumTraits::epsilon())) + if (y == Scalar(0) || abs(z) > sqrt(NumTraits::epsilon())) return RealScalar(0.5) * log((y + x) / (y - x)); else return z + z*z*z / RealScalar(3);