Hi Simon,
Simon Danisch writes:
> There is a speed difference, which you can see beautifully like this:
>
> function _sum{T}(::Type{T}, A)
> r = zero(T)
> @inbounds for i in eachindex(A)
> r += T(A[i])
> end
> r
> end
>
great, thanks. My machine seems to be way slower that yours or either I
run
Hi,
Ismael Venegas Castelló writes:
> julia> Base.sum{T<:Real, S<:Real}(::Type{T}, xs::Range{S})::T = sum(xs)
> julia> r = 1:100; sum(r), sum(Int32, r)
thanks for this, but as I understand it, for my particular case in which
I'm interested in working with 32bits Integers this would be similar t
Hi Simon,
Simon Danisch writes:
> I'm guessing that is done to prevent overflow.
> So you need to use your own implementation.
> Here are the promote rules defining this behavior:
> https://github.com/JuliaLang/julia/blob/master/base/reduce.jl#L32
> So in theory you could also implement your ow