From: Matthew Fernandez Date: Sun, 6 Mar 2022 22:50:21 +0000 (-0800) Subject: topfish compute_densities: rephrase an open coded 'hypot' X-Git-Tag: 4.0.0~185^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0cc8d3a5cfb2d8b35d1fb146f6cc913e7ba05de;p=graphviz topfish compute_densities: rephrase an open coded 'hypot' --- diff --git a/lib/topfish/rescale_layout.c b/lib/topfish/rescale_layout.c index fe5165a68..30c763e1f 100644 --- a/lib/topfish/rescale_layout.c +++ b/lib/topfish/rescale_layout.c @@ -44,9 +44,7 @@ static double *compute_densities(v_data * graph, int n, double *x, sum = 0; for (j = 1; j < graph[i].nedges; j++) { neighbor = graph[i].edges[j]; - sum += - sqrt((x[i] - x[neighbor]) * (x[i] - x[neighbor]) + - (y[i] - y[neighbor]) * (y[i] - y[neighbor])); + sum += hypot(x[i] - x[neighbor], y[i] - y[neighbor]); } densities[i] = sum / graph[i].nedges; }