Handle special case in atanh2(x,y) when y = 0.

This fixes matrix_power unit test on clang.
This commit is contained in:
Jitse Niesen 2013-03-09 16:58:05 +00:00
parent 03373f41cb
commit 97c9e3c74f

View File

@ -396,7 +396,7 @@ struct atanh2_default_impl
using std::log;
using std::sqrt;
Scalar z = x / y;
if (abs(z) > sqrt(NumTraits<RealScalar>::epsilon()))
if (y == Scalar(0) || abs(z) > sqrt(NumTraits<RealScalar>::epsilon()))
return RealScalar(0.5) * log((y + x) / (y - x));
else
return z + z*z*z / RealScalar(3);