mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 04:50:29 +00:00
fix math.prod
accumulator was not initialized to one
This commit is contained in:
@@ -1196,6 +1196,7 @@ sum :: proc "contextless" (x: $T/[]$E) -> (res: E)
|
||||
|
||||
prod :: proc "contextless" (x: $T/[]$E) -> (res: E)
|
||||
where intrinsics.type_is_numeric(E) {
|
||||
res = 1
|
||||
for i in x {
|
||||
res *= i
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user