Skip to content

Commit 03062c9

Browse files
committed
lambertw: fix jldoctests
1 parent 394bd62 commit 03062c9

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/lambertw.jl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ domain of the branch `k = 0` is `[-1/e, Inf]`. For `Complex` `z`, and all `k`, t
99
the complex plane.
1010
1111
```jldoctest
12-
julia> lambertw(-1/e, -1)
12+
julia> lambertw(-1/, -1)
1313
-1.0
1414
15-
julia> lambertw(-1/e, 0)
15+
julia> lambertw(-1/, 0)
1616
-1.0
1717
1818
julia> lambertw(0, 0)
@@ -24,6 +24,10 @@ julia> lambertw(0, -1)
2424
julia> lambertw(Complex(-10.0, 3.0), 4)
2525
-0.9274337508660128 + 26.37693445371142im
2626
```
27+
28+
```@meta
29+
DocTestSetup = :(using SpecialFunctions)
30+
```
2731
"""
2832
lambertw(z::Number, k::Integer=0; maxiter::Integer=1000) = _lambertw(z, k, maxiter)
2933

@@ -269,19 +273,23 @@ If `k=-1` and `imag(z) < 0`, the value on the branch `k=1` is returned.
269273
270274
# Example
271275
```jldoctest
272-
julia> lambertw(-1/e + 1e-18, -1)
276+
julia> lambertw(-1/ + 1e-18, -1)
273277
-1.0
274278
275279
julia> lambertwbp(1e-18, -1)
276280
-2.331643983409312e-9
277281
278282
# Same result, but 1000 times slower
279-
julia> convert(Float64, (lambertw(-BigFloat(1)/e + BigFloat(10)^(-18), -1) + 1))
283+
julia> convert(Float64, (lambertw(-BigFloat(1)/ + BigFloat(10)^(-18), -1) + 1))
280284
-2.331643983409312e-9
281285
```
282286
287+
```@meta
288+
DocTestSetup = :(using SpecialFunctions)
289+
```
290+
283291
!!! note
284-
`lambertwbp` uses a series expansion about the branch point `z=-1/e` to avoid loss of precision.
292+
`lambertwbp` uses a series expansion about the branch point `z=-1/` to avoid loss of precision.
285293
The loss of precision in `lambertw` is analogous to the loss of precision
286294
in computing the `sqrt(1-x)` for `x` close to `1`.
287295
"""

0 commit comments

Comments
 (0)