Skip to content

Commit 04041c4

Browse files
committed
fix type promotion
1 parent 5adb406 commit 04041c4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/matmul.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,10 @@ function __generic_matvecmul!(::typeof(identity), C::AbstractVector, A::Abstract
10671067
if length(B) == 0
10681068
C[i] = zero(eltype(C))
10691069
else
1070-
@stable_muladdmul _modify!(MulAddMul(alpha, beta), A[i]*B[1], C, i)
1070+
AiB1 = A[i]*B[1]
1071+
# the sum is necessary for potential type promotion
1072+
AiB1C = AiB1 + zero(AiB1)
1073+
@stable_muladdmul _modify!(MulAddMul(alpha, beta), AiB1C, C, i)
10711074
end
10721075
end
10731076
if !iszero(alpha)

0 commit comments

Comments
 (0)