Skip to content

Commit

Permalink
Merge pull request #3961 from GunnarFarneback/range
Browse files Browse the repository at this point in the history
Repair floating point ranges with start==stop.
  • Loading branch information
StefanKarpinski committed Aug 6, 2013
2 parents 0d39c66 + 5c304b7 commit cc864d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function colon{T<:Real}(start::T, step::T, stop::T)
nf = (stop-start)/step + 1
if T <: FloatingPoint
n = round(nf)
if abs(n-nf) < eps(n)*3
if n > 1 && abs(n-nf) < eps(n)*3
# adjust step to try to hit stop exactly
step = (stop-start)/(n-1)
len = itrunc(n)
Expand Down

0 comments on commit cc864d3

Please sign in to comment.