Range (statistics)

julia> using BenchmarkTools

julia> datarange(x) = -(-(extrema(x)...))
datarange (generic function with 1 method)

julia> @btime datarange($x)
  161.395 ns (0 allocations: 0 bytes)
9.91438063817977

julia> @btime maximum($x) - minimum($x)
  257.181 ns (0 allocations: 0 bytes)
9.91438063817977
1 Like