From 33d6e3006c73611a7a85959bc24c0a17405fd4df Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Sun, 11 Apr 2021 14:31:06 -0400 Subject: [PATCH] new AbstractFloat methods --- base/broadcast.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/base/broadcast.jl b/base/broadcast.jl index 3e8f333168828..f47a054d97411 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -1156,11 +1156,13 @@ broadcasted(::DefaultArrayStyle{1}, ::typeof(-), r1::AbstractRange, r2::Abstract broadcasted(::DefaultArrayStyle{1}, ::typeof(*), x::Number, r::AbstractRange) = StepRangeLen(x*first(r), x*step(r), length(r)) broadcasted(::DefaultArrayStyle{1}, ::typeof(*), x::Number, r::StepRangeLen{T}) where {T} = StepRangeLen{typeof(x*T(r.ref))}(x*r.ref, x*r.step, length(r), r.offset) +broadcasted(::DefaultArrayStyle{1}, ::typeof(*), x::AbstractFloat, r::AbstractRange) = Base.range_start_step_length(x*first(r), x*step(r), length(r)) broadcasted(::DefaultArrayStyle{1}, ::typeof(*), x::Number, r::LinRange) = LinRange(x * r.start, x * r.stop, r.len) # separate in case of noncommutative multiplication: broadcasted(::DefaultArrayStyle{1}, ::typeof(*), r::AbstractRange, x::Number) = StepRangeLen(first(r)*x, step(r)*x, length(r)) broadcasted(::DefaultArrayStyle{1}, ::typeof(*), r::StepRangeLen{T}, x::Number) where {T} = StepRangeLen{typeof(T(r.ref)*x)}(r.ref*x, r.step*x, length(r), r.offset) +broadcasted(::DefaultArrayStyle{1}, ::typeof(*), r::AbstractRange, x::AbstractFloat) = Base.range_start_step_length(first(r)*x, step(r)*x, length(r)) broadcasted(::DefaultArrayStyle{1}, ::typeof(*), r::LinRange, x::Number) = LinRange(r.start * x, r.stop * x, r.len) broadcasted(::DefaultArrayStyle{1}, ::typeof(/), r::AbstractRange, x::Number) = range(first(r)/x, step=step(r)/x, length=length(r))