Skip to content

Commit

Permalink
Set type correctly for older Julia versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen committed Apr 13, 2023
1 parent 0d3733b commit 1d4bcae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils.jl
Expand Up @@ -146,7 +146,8 @@ end
Compute the absolute deviation of `x` from `Statistics.median(x)`.
"""
function _fold_around_median(x)
y = similar(x, float(eltype(x)))
T = promote_type(eltype(x), typeof(zero(eltype(x)) / 1))
y = similar(x, T)
# avoid using the `dims` keyword for median because it
# - can error for Union{Missing,Real} (https://github.com/JuliaStats/Statistics.jl/issues/8)
# - is type-unstable (https://github.com/JuliaStats/Statistics.jl/issues/39)
Expand Down

0 comments on commit 1d4bcae

Please sign in to comment.