Skip to content

Commit

Permalink
faster max and min for float arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Aug 8, 2013
1 parent ad1b0de commit 13f2f05
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1466,24 +1466,24 @@ function prod{T}(A::AbstractArray{T})
v
end

function min{T<:Integer}(A::AbstractArray{T})
function min(A::AbstractArray)
if isempty(A); error("min: argument is empty"); end
v = A[1]
for i=2:length(A)
x = A[i]
if x < v
if x < v || v!=v
v = x
end
end
v
end

function max{T<:Integer}(A::AbstractArray{T})
function max(A::AbstractArray)
if isempty(A); error("max: argument is empty"); end
v = A[1]
for i=2:length(A)
x = A[i]
if x > v
if x > v || v!=v
v = x
end
end
Expand Down

0 comments on commit 13f2f05

Please sign in to comment.