Skip to content

Commit

Permalink
Merge pull request #245 from rigetti/issue241
Browse files Browse the repository at this point in the history
Fix issue #241
  • Loading branch information
ajkeller34 authored Jun 19, 2019
2 parents 584d50d + 8d7ebda commit 0dbc96d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/units.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ end

function *(x::Base.TwicePrecision{Q}, v::Real) where Q<:Quantity
v == 0 && return Base.TwicePrecision(x.hi*v, x.lo*v)
x * Base.TwicePrecision(oftype(ustrip(x.hi)*v, v))
(ustrip(x) * Base.TwicePrecision(oftype(ustrip(x.hi)*v, v))) * unit(x)
end

Base.mul12(x::Quantity, y::Quantity) = Base.mul12(ustrip(x), ustrip(y)) .* (unit(x) * unit(y))
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,8 @@ end
@test_throws DimensionError range(1.0m, step=1.0V, length=5)
@test_throws ArgumentError 1.0m:0.0m:5.0m
@test (-2.0Hz:1.0Hz:2.0Hz)/1.0Hz == -2.0:1.0:2.0 # issue 160
@test (range(0, stop=2, length=5) * u"°")[2:end] ==
range(0.5, stop=2, length=4) * u"°" # issue 241
end
@testset ">> LinSpace" begin
# Not using Compat.range for these because kw args don't infer in julia 0.6.2
Expand Down

0 comments on commit 0dbc96d

Please sign in to comment.