Skip to content

Commit

Permalink
another float range fix (#2333). thanks to @stevengj
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Feb 17, 2013
1 parent 3c702d2 commit ebdfbce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ function colon{T<:Real}(start::T, step::T, stop::T)
if abs(n-nf) < eps(n)*3
# adjust step to try to hit stop exactly
step = (stop-start)/(n-1)
len = itrunc(n)
else
len = itrunc(nf)
end
len = itrunc(n)
else
n = nf
len = iround(n)
Expand Down
1 change: 1 addition & 0 deletions test/corelib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ r = [5:-1:1]
@test length(.1:.1:.3) == 3
@test length(1.1:1.1:3.3) == 3
@test length(1.1:1.3:3) == 2
@test length(1:1:1.8) == 1

let
span = 5:20
Expand Down

0 comments on commit ebdfbce

Please sign in to comment.