Skip to content

Commit fe68737

Browse files
authored
Fix docstring examples (#38)
* Fix docstring examples Replace `using NaNMath as nm` in examples (in docstrings) with `using NaNMath; const nm = NaNMath` * Update NaNMath.jl
1 parent 400c693 commit fe68737

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/NaNMath.jl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ NaNMath.sum(A)
3535
3636
##### Examples:
3737
```julia
38-
using NaNMath as nm
39-
nm.sum([1., 2., NaN]) # result: 3.0
38+
using NaNMath
39+
NaNMath.sum([1., 2., NaN]) # result: 3.0
4040
```
4141
"""
4242
function sum(x::AbstractArray{T}) where T<:AbstractFloat
@@ -72,8 +72,8 @@ NaNMath.maximum(A)
7272
7373
##### Examples:
7474
```julia
75-
using NaNMath as nm
76-
nm.maximum([1., 2., NaN]) # result: 2.0
75+
using NaNMath
76+
NaNMath.maximum([1., 2., NaN]) # result: 2.0
7777
```
7878
"""
7979
function maximum(x::AbstractArray{T}) where T<:AbstractFloat
@@ -99,8 +99,8 @@ NaNMath.minimum(A)
9999
100100
##### Examples:
101101
```julia
102-
using NaNMath as nm
103-
nm.minimum([1., 2., NaN]) # result: 1.0
102+
using NaNMath
103+
NaNMath.minimum([1., 2., NaN]) # result: 1.0
104104
```
105105
"""
106106
function minimum(x::AbstractArray{T}) where T<:AbstractFloat
@@ -126,8 +126,8 @@ NaNMath.extrema(A)
126126
127127
##### Examples:
128128
```julia
129-
using NaNMath as nm
130-
nm.extrema([1., 2., NaN]) # result: 1.0, 2.0
129+
using NaNMath
130+
NaNMath.extrema([1., 2., NaN]) # result: 1.0, 2.0
131131
```
132132
"""
133133
function extrema(x::AbstractArray{T}) where T<:AbstractFloat
@@ -156,8 +156,8 @@ NaNMath.mean(A)
156156
157157
##### Examples:
158158
```julia
159-
using NaNMath as nm
160-
nm.mean([1., 2., NaN]) # result: 1.5
159+
using NaNMath
160+
NaNMath.mean([1., 2., NaN]) # result: 1.5
161161
```
162162
"""
163163
function mean(x::AbstractArray{T}) where T<:AbstractFloat
@@ -201,8 +201,8 @@ NaNMath.var(A)
201201
202202
##### Examples:
203203
```julia
204-
using NaNMath as nm
205-
nm.var([1., 2., NaN]) # result: 0.5
204+
using NaNMath
205+
NaNMath.var([1., 2., NaN]) # result: 0.5
206206
```
207207
"""
208208
function var(x::Vector{T}) where T<:AbstractFloat
@@ -235,8 +235,8 @@ NaNMath.std(A)
235235
236236
##### Examples:
237237
```julia
238-
using NaNMath as nm
239-
nm.std([1., 2., NaN]) # result: 0.7071067811865476
238+
using NaNMath
239+
NaNMath.std([1., 2., NaN]) # result: 0.7071067811865476
240240
```
241241
"""
242242
function std(x::Vector{T}) where T<:AbstractFloat
@@ -313,3 +313,4 @@ for f in (:min, :max)
313313
end
314314

315315
end
316+

0 commit comments

Comments
 (0)