Browse Source

Merge pull request #3924 from martin-frbg/numpy22025

Avoid overflow from division in GETF2 potentially causing NaN
tags/v0.3.22^2
Martin Kroeker GitHub 2 years ago
parent
commit
5925178d03
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions
  1. +2
    -1
      lapack/getf2/getf2_k.c
  2. +3
    -2
      lapack/getf2/zgetf2_k.c

+ 2
- 1
lapack/getf2/getf2_k.c View File

@@ -99,7 +99,8 @@ blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa,
jp--;
temp1 = *(b + jp);

if (temp1 != ZERO) {
//if (temp1 != ZERO) {
if (fabs(temp1) > 1.e-305) {
temp1 = dp1 / temp1;

if (jp != j) {


+ 3
- 2
lapack/getf2/zgetf2_k.c View File

@@ -105,8 +105,9 @@ blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa,
temp1 = *(b + jp * 2 + 0);
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) {
SWAP_K(j + 1, 0, 0, ZERO, ZERO, a + j * 2, lda,
a + jp * 2, lda, NULL, 0);


Loading…
Cancel
Save