JuliaLang/julia

Unconsistent result when using sum or mean function on Complex{Int8} array

Offen

#15.523 geöffnet am 15.03.2016

 (8 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Julia (5.773 Forks)batch import
complexfoldgood first issuemaths

Repository-Metriken

Stars
 (48.709 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 20T 6h) (157 gemergte PRs in 30 T)

Beschreibung

When using Complex{Int8} arrays, the functions sum and mean do not make proper type conversion to avoid nasty things :

julia> b = ones(Complex{Int8}, 100000) ;

julia> sum(b)
-96 + 0im

julia> mean(b)
-0.00096 + 0.0im

That seems unconsistent with the behaviour of the same functions on Int8 arrays :

julia> a = ones(Int8, 100000) ;

julia> sum(a)
100000

julia> mean(a)
1.0

Contributor Guide