From: Matthew Fernandez Date: Sun, 6 Mar 2022 22:58:33 +0000 (-0800) Subject: pathplan dist_n: rephrase an open coded 'hypot' X-Git-Tag: 4.0.0~185^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a792affa6d99c4e7ec3586b353e9ad62806c0197;p=graphviz pathplan dist_n: rephrase an open coded 'hypot' --- diff --git a/lib/pathplan/route.c b/lib/pathplan/route.c index f41a0d610..7857e2c9b 100644 --- a/lib/pathplan/route.c +++ b/lib/pathplan/route.c @@ -196,9 +196,7 @@ static double dist_n(Ppoint_t * p, int n) rv = 0.0; for (i = 1; i < n; i++) { - rv += - sqrt((p[i].x - p[i - 1].x) * (p[i].x - p[i - 1].x) + - (p[i].y - p[i - 1].y) * (p[i].y - p[i - 1].y)); + rv += hypot(p[i].x - p[i - 1].x, p[i].y - p[i - 1].y); } return rv; }