From: Matthew Fernandez Date: Thu, 8 Sep 2022 00:27:49 +0000 (-0700) Subject: dotgen leftOf: perform computation in double range X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e0a27d699b7f22e4d6444a9038a562db5830c8e;p=graphviz dotgen leftOf: perform computation in double range It is not clear to me why this code was implicitly converting the result of its computation to `int`. Doing the entire thing in `double` is more precise and squashes a compiler warning. --- diff --git a/lib/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index 15c194755..5d35c588f 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -1677,10 +1677,7 @@ make_flat_edge(graph_t* g, spline_info_t* sp, path * P, edge_t ** edges, int ind static int leftOf (pointf p1, pointf p2, pointf p3) { - int d; - - d = (p1.y - p2.y) * (p3.x - p2.x) - (p3.y - p2.y) * (p1.x - p2.x); - return d > 0; + return (p1.y - p2.y) * (p3.x - p2.x) - (p3.y - p2.y) * (p1.x - p2.x) > 0; } /* makeLineEdge: