Skip to content

Commit 4e7f76c

Browse files
committed
invlogcdf_newton(): refactor using newton()
1 parent 2590ac0 commit 4e7f76c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/quantilealgs.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,9 @@ function invlogcdf_newton(d::ContinuousUnivariateDistribution, lp::Real, xs::Rea
9797
if -Inf < lp < 0
9898
x0 = T(xs)
9999
if lp < logcdf(d,x0)
100-
x = x0 + f_a(x0)
101-
while abs(x-x0) > max(abs(x),abs(x0)) * tol
102-
x0 = x
103-
x = x0 + f_a(x0)
104-
end
100+
return newton(f_a, T(xs), tol)
105101
else
106-
x = x0 + f_b(x0)
107-
while abs(x-x0) > max(abs(x),abs(x0))*tol
108-
x0 = x
109-
x = x0 + f_b(x0)
110-
end
102+
return newton(f_b, T(xs), tol)
111103
end
112104
return x
113105
elseif lp == -Inf

0 commit comments

Comments
 (0)