fix math.prod
accumulator was not initialized to one
This commit is contained in:
1 parent
4423bc0706
commit
4ebdb6740e
1 file changed
+1
@@ -1196,6 +1196,7 @@ sum :: proc "contextless" (x: $T/[]$E) -> (res: E)
|
|||||||
|
|
||||||
prod :: proc "contextless" (x: $T/[]$E) -> (res: E)
|
prod :: proc "contextless" (x: $T/[]$E) -> (res: E)
|
||||||
where intrinsics.type_is_numeric(E) {
|
where intrinsics.type_is_numeric(E) {
|
||||||
|
res = 1
|
||||||
for i in x {
|
for i in x {
|
||||||
res *= i
|
res *= i
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user