]> granicus.if.org Git - graphviz/commitdiff
Fix bug in vpsc code where a divide by 0 may occur
authorerg <devnull@localhost>
Mon, 28 Apr 2008 16:52:59 +0000 (16:52 +0000)
committererg <devnull@localhost>
Mon, 28 Apr 2008 16:52:59 +0000 (16:52 +0000)
lib/neatogen/quad_prog_vpsc.c

index b6f6256b908c10f7b5ea51c3c7b7c69b3e8fd38e..46c66f59f51386e31be9ff0477d7dcf7ef851c1c 100644 (file)
@@ -143,7 +143,10 @@ constrained_majorization_vpsc(CMajEnvVPSC * e, float *b, float *place,
            }
            denominator += r * d[i];
        }
-       beta = numerator / denominator;
+       if (denominator != 0.0)
+           beta = numerator / denominator;
+       else
+           beta = 1.0;
 
        for (i = 0; i < n; i++) {
            /* beta > 1.0 takes us back outside the feasible region