Skip to content

Commit

Permalink
Merge pull request #86 from timholy/teh/fix_85
Browse files Browse the repository at this point in the history
Define *(::TwicePrecision, ::Quantity)
  • Loading branch information
ajkeller34 authored May 31, 2017
2 parents 7e05d16 + c83bcce commit 1164e20
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

Expand Down
1 change: 1 addition & 0 deletions src/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ _colon{T}(::Any, ::Any, start::T, step, stop::T) =

# Opt into TwicePrecision functionality
*(x::Base.TwicePrecision, y::Units) = Base.TwicePrecision(x.hi*y, x.lo*y)
*(x::Base.TwicePrecision, y::Quantity) = (x * ustrip(y)) * unit(y)
function colon(start::T, step::T, stop::T) where (T<:Quantity{S}
where S<:Union{Float16,Float32,Float64})
# This will always return a StepRangeLen
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,10 @@ end
@test @inferred((1:5)*mm) === 1mm:1mm:5mm
@test @inferred((1:2:5)*mm) === 1mm:2mm:5mm
@test @inferred((1.0:2.0:5.01)*mm) === 1.0mm:2.0mm:5.0mm
r = @inferred(range(0.1, 0.1, 3) * 1.0s)
if VERSION >= v"0.6.0-pre"
@test r[3] === 0.3s
end
end
end
@testset "> Arrays" begin
Expand Down

0 comments on commit 1164e20

Please sign in to comment.