@@ -21,7 +21,10 @@ inline fvar<T> pow(const fvar<T>& x1, const fvar<T>& x2) {
2121 using std::pow;
2222 T pow_x1_x2 (pow (x1.val_ , x2.val_ ));
2323 if (value_of (x1) == 0.0 ) {
24- return fvar<T>(pow_x1_x2, std::numeric_limits<double >::quiet_NaN ()); // partials zero, avoids log(0) & /0
24+ return fvar<T>(
25+ pow_x1_x2,
26+ std::numeric_limits<double >::quiet_NaN ()); // partials zero, avoids
27+ // log(0) & /0
2528 }
2629 return fvar<T>(pow_x1_x2, (x2.d_ * log (x1.val_ ) + x2.val_ * x1.d_ / x1.val_ )
2730 * pow_x1_x2);
@@ -33,7 +36,9 @@ inline fvar<T> pow(U x1, const fvar<T>& x2) {
3336 using std::pow;
3437 T u = pow (x1, x2.val_ );
3538 if (x1 == 0.0 ) {
36- return fvar<T>(u, std::numeric_limits<double >::quiet_NaN ()); // partials undefined, avoids log(0)
39+ return fvar<T>(
40+ u, std::numeric_limits<double >::quiet_NaN ()); // partials undefined,
41+ // avoids log(0)
3742 }
3843 return fvar<T>(u, x2.d_ * log (x1) * u);
3944}
@@ -61,7 +66,10 @@ inline fvar<T> pow(const fvar<T>& x1, U x2) {
6166 return square (x1);
6267 }
6368 if (x2 == 0.0 ) {
64- return fvar<T>(pow (x1.val_ , x2), std::numeric_limits<double >::quiet_NaN ()); // partials undefined, avoid pow(0,-1)
69+ return fvar<T>(
70+ pow (x1.val_ , x2),
71+ std::numeric_limits<double >::quiet_NaN ()); // partials undefined, avoid
72+ // pow(0,-1)
6573 }
6674 return fvar<T>(pow (x1.val_ , x2), x1.d_ * x2 * pow (x1.val_ , x2 - 1 ));
6775}
0 commit comments