From: Matthew Fernandez Date: Wed, 5 May 2021 03:45:22 +0000 (-0700) Subject: replace hypotenuse calculation in computeoffset_qr with a call to hypot X-Git-Tag: 2.47.2~16^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53ec611641cc2497ed70dd168d466259ee3b8d3c;p=graphviz replace hypotenuse calculation in computeoffset_qr with a call to hypot The function hypot is available in C99 and has the potential to compute the same operation more efficiently and with greater precision. --- diff --git a/lib/common/emit.c b/lib/common/emit.c index ae23ba533..0d799e449 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1996,7 +1997,7 @@ static pointf computeoffset_qr(pointf p, pointf q, pointf r, pointf s, double len; double x = q.x - r.x, y = q.y - r.y; - len = sqrt(x * x + y * y); + len = hypot(x, y); if (len < EPSILON) { /* control points are on top of each other use slope between endpoints instead */