Skip to content

Commit 7272c82

Browse files
authored
Apply style suggestions from code review
1 parent 294f312 commit 7272c82

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

stan/math/fwd/fun/sqrt.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ namespace math {
1616
template <typename T>
1717
inline fvar<T> sqrt(const fvar<T>& x) {
1818
using std::sqrt;
19-
if (value_of_rec(x.val_) == 0.0)
19+
if (value_of_rec(x.val_) == 0.0) {
2020
return fvar<T>(sqrt(x.val_), 0.0 * x.d_);
21+
}
2122
return fvar<T>(sqrt(x.val_), 0.5 * x.d_ * inv_sqrt(x.val_));
2223
}
2324

stan/math/rev/fun/sqrt.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ namespace math {
4343
*/
4444
inline var sqrt(const var& a) {
4545
return make_callback_var(std::sqrt(a.val()), [a](auto& vi) mutable {
46-
if (vi.val() != 0.0)
46+
if (vi.val() != 0.0) {
4747
a.adj() += vi.adj() / (2.0 * vi.val());
48+
}
4849
});
4950
}
5051

0 commit comments

Comments
 (0)