]> granicus.if.org Git - graphviz/commitdiff
lu_decompose: rephrase comparisons against 'biggest' to avoid equals
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 11 Sep 2021 17:10:42 +0000 (10:10 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 19 Sep 2021 02:31:32 +0000 (19:31 -0700)
This squashes some -Wfloat-equal warnings, but has the same effect due to the
surrounding code ensuring `biggest` can only ever increase from 0.

lib/neatogen/lu.c

index e0e013ae9892d3b44ceceaaa478bf9ae8daf09c3..b18125fe7624b06f5376bf8371cbf0808f949abc 100644 (file)
@@ -80,7 +80,7 @@ int lu_decompose(double **a, int n)
        biggest = 0.0;
        for (j = 0; j < n; j++)
            biggest = fmax(biggest, fabs(lu[i][j] = a[i][j]));
-       if (biggest != 0.0)
+       if (biggest > 0.0)
            scales[i] = 1.0 / biggest;
        else {
            scales[i] = 0.0;
@@ -98,7 +98,7 @@ int lu_decompose(double **a, int n)
                pivotindex = i;
            }
        }
-       if (biggest == 0.0)
+       if (biggest <= 0.0)
            return (0);         /* Zero column: singular matrix */
        if (pivotindex != k) {  /* Update pivot sequence */
            j = ps[k];