]> granicus.if.org Git - graphviz/commitdiff
use hypotf to squash a -Wfloat-conversion warning
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 2 May 2021 03:17:30 +0000 (20:17 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 16 May 2021 16:40:29 +0000 (09:40 -0700)
For the same reason as the previous commit, this fixes an intermingling of
doubles and floats, and also abbreviates code.

lib/neatogen/sgd.c

index f6600394260ff2d44e725a70144194458a8486ab..6dcf633677628677bbe6c4ff7b246e10ab01de20 100644 (file)
@@ -226,7 +226,7 @@ void sgd(graph_t *G, /* input graph */
 
             float dx = pos[2*terms[ij].i] - pos[2*terms[ij].j];
             float dy = pos[2*terms[ij].i+1] - pos[2*terms[ij].j+1];
-            float mag = sqrt(dx*dx + dy*dy);
+            float mag = hypotf(dx, dy);
 
             float r = (mu * (mag-terms[ij].d)) / (2*mag);
             float r_x = r * dx;