Skip to content

Commit 5bf75c2

Browse files
committed
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
1 parent a850ce3 commit 5bf75c2

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

stan/math/fwd/fun/pow.hpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

stan/math/rev/fun/pow.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,12 @@ inline var pow(const Scal1& base, const Scal2& exponent) {
8787
return make_callback_var(
8888
std::pow(value_of(base), value_of(exponent)),
8989
[base, exponent](auto&& vi) mutable {
90-
if (value_of(base) == 0.0) { // partials zero, avoids 0 & log(0)
91-
if(value_of(exponent) == 0.0)
92-
{
93-
forward_as<var>(base).adj()
94-
+= std::numeric_limits<double>::quiet_NaN();
95-
return;
96-
}
90+
if (value_of(base) == 0.0) { // partials zero, avoids 0 & log(0)
91+
if (value_of(exponent) == 0.0) {
92+
forward_as<var>(base).adj()
93+
+= std::numeric_limits<double>::quiet_NaN();
94+
return;
95+
}
9796
return;
9897
}
9998
const double vi_mul = vi.adj() * vi.val();

0 commit comments

Comments
 (0)