From 823b2105b660ad9953036eea00da61bd2822d7e0 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 22 Sep 2011 17:34:25 +0200 Subject: [PATCH] fix atan2 when tmp4==0 --- unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 3510fba77..0afea3b7d 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -569,6 +569,7 @@ inline const AutoDiffScalar::Scalar,D atan2(const AutoDiffScalar& a, const AutoDiffScalar& b) { using std::atan2; + using std::max; typedef typename internal::traits::Scalar Scalar; typedef AutoDiffScalar > PlainADS; PlainADS ret; @@ -580,8 +581,6 @@ atan2(const AutoDiffScalar& a, const AutoDiffScalar& b) if (tmp4!=0) ret.derivatives() = (a.derivatives() * b.value() - a.value() * b.derivatives()) * (tmp2+tmp3); - else - ret.derivatives().setZero(); return ret; }