Merge pull request #3924 from martin-frbg/numpy22025

Avoid overflow from division in GETF2 potentially causing NaN
This commit is contained in:
Martin Kroeker 2023-02-27 15:59:44 +01:00 committed by GitHub
commit 5925178d03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -99,7 +99,8 @@ blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa,
jp--; jp--;
temp1 = *(b + jp); temp1 = *(b + jp);
if (temp1 != ZERO) { //if (temp1 != ZERO) {
if (fabs(temp1) > 1.e-305) {
temp1 = dp1 / temp1; temp1 = dp1 / temp1;
if (jp != j) { if (jp != j) {

View File

@ -105,7 +105,8 @@ blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa,
temp1 = *(b + jp * 2 + 0); temp1 = *(b + jp * 2 + 0);
temp2 = *(b + jp * 2 + 1); temp2 = *(b + jp * 2 + 1);
if ((temp1 != ZERO) || (temp2 != ZERO)) { // if ((temp1 != ZERO) || (temp2 != ZERO)) {
if ((fabs(temp1) > 1.e-305) || (fabs(temp2) > 1.e-305)) {
if (jp != j) { if (jp != j) {
SWAP_K(j + 1, 0, 0, ZERO, ZERO, a + j * 2, lda, SWAP_K(j + 1, 0, 0, ZERO, ZERO, a + j * 2, lda,