Skip to content

Commit 0ce1415

Browse files
committed
lambertw: fix jldoctests
1 parent 1dc13d8 commit 0ce1415

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/lambertw.jl

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ either `0` or `-1`. For `Real` `z`, the domain of the branch `k = -1` is `[-1/e,
88
domain of the branch `k = 0` is `[-1/e, Inf]`. For `Complex` `z`, and all `k`, the domain is
99
the complex plane.
1010
11-
```jldoctest
12-
julia> lambertw(-1/e, -1)
11+
```jldoctest; setup=:(using SpecialFunctions)
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)
@@ -268,20 +268,19 @@ The result is accurate to Float64 precision for abs(z) < 0.32.
268268
If `k=-1` and `imag(z) < 0`, the value on the branch `k=1` is returned.
269269
270270
# Example
271-
```jldoctest
272-
julia> lambertw(-1/e + 1e-18, -1)
271+
```jldoctest; setup=:(using SpecialFunctions)
272+
julia> lambertw(-1/ + 1e-18, -1)
273273
-1.0
274274
275275
julia> lambertwbp(1e-18, -1)
276276
-2.331643983409312e-9
277277
278-
# Same result, but 1000 times slower
279-
julia> convert(Float64, (lambertw(-BigFloat(1)/e + BigFloat(10)^(-18), -1) + 1))
278+
julia> convert(Float64, (lambertw(-big(1)/ℯ + big(10)^(-18), -1) + 1)) # Same result, but 1000 times slower
280279
-2.331643983409312e-9
281280
```
282281
283282
!!! note
284-
`lambertwbp` uses a series expansion about the branch point `z=-1/e` to avoid loss of precision.
283+
`lambertwbp` uses a series expansion about the branch point `z=-1/` to avoid loss of precision.
285284
The loss of precision in `lambertw` is analogous to the loss of precision
286285
in computing the `sqrt(1-x)` for `x` close to `1`.
287286
"""

0 commit comments

Comments
 (0)