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);