Skip to content

Commit 37ccbee

Browse files
author
oscarddssmith
committed
fix sqrt sign
1 parent aa5b954 commit 37ccbee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/jvp.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function finite_difference_jvp(
8686
end
8787
(; x1, fx1) = cache
8888

89-
tmp = sqrt(dot(_vec(x), _vec(v)))
89+
tmp = sqrt(abs(dot(_vec(x), _vec(v))))
9090
epsilon = compute_epsilon(fdtype, tmp, relstep, absstep, dir)
9191
if fdtype == Val(:forward)
9292
fx = f_in isa Nothing ? f(x) : f_in
@@ -167,7 +167,7 @@ function finite_difference_jvp!(
167167
end
168168

169169
(;x1, fx1) = cache
170-
tmp = sqrt(dot(_vec(x), _vec(v)))
170+
tmp = sqrt(abs(dot(_vec(x), _vec(v))))
171171
epsilon = compute_epsilon(fdtype, tmp, relstep, absstep, dir)
172172
if fdtype == Val(:forward)
173173
if f_in isa Nothing

0 commit comments

Comments
 (0)