Skip to content

Commit

Permalink
Add a typecast to fit the type b/w sma and runmean
Browse files Browse the repository at this point in the history
Due to the mismatch of the argument types between `sma` and `runmean`, it should be typecasted from Real to Float.
  • Loading branch information
hassiweb committed Apr 12, 2020
1 parent 34704f2 commit c69c38a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ma.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sma(x::Array{T}; n::Int64=10)::Array{T}
Simple moving average (SMA)
"""
function sma(x::Array{T}; n::Int64=10)::Array{T} where {T<:Real}
return runmean(x, n=n, cumulative=false)
return runmean(convert(Array{Float64}, x), n=n, cumulative=false)
end

"""
Expand Down

0 comments on commit c69c38a

Please sign in to comment.