diff --git a/kernel/zarch/zscal.c b/kernel/zarch/zscal.c index 9fcf47cc43..63f36e972f 100644 --- a/kernel/zarch/zscal.c +++ b/kernel/zarch/zscal.c @@ -381,7 +381,8 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i, x[i + 1] = da_i * x[i]; else x[i + 1] = NAN; - x[i] = temp0; + if (isfinite(x[i])) + x[i] = temp0; i += 2; j++; @@ -396,6 +397,7 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r, FLOAT da_i, while (j < n) { temp0 = da_r * x[i]; + if (isinf(x[i]) x[i + 1] = da_r * x[i + 1]; x[i] = temp0; i += 2;