Browse Source

fix math.prod

accumulator was not initialized to one
gilles 3 years ago
parent
commit
4ebdb6740e
1 changed files with 1 additions and 0 deletions
  1. 1 0
      core/math/math.odin

+ 1 - 0
core/math/math.odin

@@ -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
 	}