Skip to content

Commit 46d4245

Browse files
authored
Merge pull request #25 from mlubin/fbot/deps
Run femtocleaner
2 parents b496452 + d8bea8b commit 46d4245

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/NaNMath.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ for f in (:sin, :cos, :tan, :asin, :acos, :acosh, :atanh, :log, :log2, :log10,
77
($f)(x::Float64) = ccall(($(string(f)),Base.Math.libm), Float64, (Float64,), x)
88
($f)(x::Float32) = ccall(($(string(f,"f")),Base.Math.libm), Float32, (Float32,), x)
99
($f)(x::Real) = ($f)(float(x))
10-
function ($f){T<:Number}(x::AbstractArray{T})
10+
function ($f)(x::AbstractArray{T}) where T<:Number
1111
Base.depwarn("$f{T<:Number}(x::AbstractArray{T}) is deprecated, use $f.(x) instead.", $f)
1212
return ($f).(x)
1313
end
@@ -38,7 +38,7 @@ using NaNMath as nm
3838
nm.sum([1., 2., NaN]) # result: 3.0
3939
```
4040
"""
41-
function sum{T<:AbstractFloat}(x::AbstractArray{T})
41+
function sum(x::AbstractArray{T}) where T<:AbstractFloat
4242
if length(x) == 0
4343
result = zero(eltype(x))
4444
else
@@ -75,7 +75,7 @@ using NaNMath as nm
7575
nm.maximum([1., 2., NaN]) # result: 2.0
7676
```
7777
"""
78-
function maximum{T<:AbstractFloat}(x::AbstractArray{T})
78+
function maximum(x::AbstractArray{T}) where T<:AbstractFloat
7979
result = convert(eltype(x), NaN)
8080
for i in x
8181
if !isnan(i)
@@ -102,7 +102,7 @@ using NaNMath as nm
102102
nm.minimum([1., 2., NaN]) # result: 1.0
103103
```
104104
"""
105-
function minimum{T<:AbstractFloat}(x::AbstractArray{T})
105+
function minimum(x::AbstractArray{T}) where T<:AbstractFloat
106106
result = convert(eltype(x), NaN)
107107
for i in x
108108
if !isnan(i)
@@ -129,7 +129,7 @@ using NaNMath as nm
129129
nm.extrema([1., 2., NaN]) # result: 1.0, 2.0
130130
```
131131
"""
132-
function extrema{T<:AbstractFloat}(x::AbstractArray{T})
132+
function extrema(x::AbstractArray{T}) where T<:AbstractFloat
133133
resultmin, resultmax = convert(eltype(x), NaN), convert(eltype(x), NaN)
134134
for i in x
135135
if !isnan(i)
@@ -159,15 +159,15 @@ using NaNMath as nm
159159
nm.mean([1., 2., NaN]) # result: 1.5
160160
```
161161
"""
162-
function mean{T<:AbstractFloat}(x::AbstractArray{T})
162+
function mean(x::AbstractArray{T}) where T<:AbstractFloat
163163
return mean_count(x)[1]
164164
end
165165

166166
"""
167167
Returns a tuple of the arithmetic mean of all elements in the array, ignoring NaN's,
168168
and the number of non-NaN values in the array.
169169
"""
170-
function mean_count{T<:AbstractFloat}(x::AbstractArray{T})
170+
function mean_count(x::AbstractArray{T}) where T<:AbstractFloat
171171
sum = convert(eltype(x), NaN)
172172
count = 0
173173
for i in x
@@ -204,7 +204,7 @@ using NaNMath as nm
204204
nm.var([1., 2., NaN]) # result: 0.5
205205
```
206206
"""
207-
function var{T<:AbstractFloat}(x::Vector{T})
207+
function var(x::Vector{T}) where T<:AbstractFloat
208208
mean_val, n = mean_count(x)
209209
if !isnan(mean_val)
210210
sum_square = zero(eltype(x))
@@ -238,7 +238,7 @@ using NaNMath as nm
238238
nm.std([1., 2., NaN]) # result: 0.7071067811865476
239239
```
240240
"""
241-
function std{T<:AbstractFloat}(x::Vector{T})
241+
function std(x::Vector{T}) where T<:AbstractFloat
242242
return sqrt(var(x))
243243
end
244244

@@ -259,7 +259,7 @@ julia> NaNMath.min(1, 2)
259259
1
260260
```
261261
"""
262-
min{T<:AbstractFloat}(x::T, y::T) = ifelse((y < x) | (signbit(y) > signbit(x)),
262+
min(x::T, y::T) where {T<:AbstractFloat} = ifelse((y < x) | (signbit(y) > signbit(x)),
263263
ifelse(isnan(y), x, y),
264264
ifelse(isnan(x), y, x))
265265

@@ -280,7 +280,7 @@ julia> NaNMath.max(1, 2)
280280
2
281281
```
282282
"""
283-
max{T<:AbstractFloat}(x::T, y::T) = ifelse((y > x) | (signbit(y) < signbit(x)),
283+
max(x::T, y::T) where {T<:AbstractFloat} = ifelse((y > x) | (signbit(y) < signbit(x)),
284284
ifelse(isnan(y), x, y),
285285
ifelse(isnan(x), y, x))
286286

0 commit comments

Comments
 (0)