Skip to content

Commit 812e62b

Browse files
author
Andrew Homan
committed
In the definition of prod(), forgot to change the reduce() to start from one instead of zero. D'oh.
1 parent 6612783 commit 812e62b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mapreduce.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ end
9292

9393
# These are all similar in Base but not @inline'd
9494
@inline sum{T}(a::StaticArray{T}) = reduce(+, zero(T), a)
95-
@inline prod{T}(a::StaticArray{T}) = reduce(*, zero(T), a)
95+
@inline prod{T}(a::StaticArray{T}) = reduce(*, one(T), a)
9696
@inline count(a::StaticArray{Bool}) = reduce(+, 0, a)
9797
@inline all(a::StaticArray{Bool}) = reduce(&, true, a) # non-branching versions
9898
@inline any(a::StaticArray{Bool}) = reduce(|, false, a) # (benchmarking needed)

0 commit comments

Comments
 (0)