]> granicus.if.org Git - graphviz/commitdiff
fdpgen dumpstat: rephrase an open coded 'hypot'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 6 Mar 2022 23:05:54 +0000 (15:05 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 9 Mar 2022 07:33:29 +0000 (23:33 -0800)
lib/fdpgen/tlayout.c

index 86155b541cf322384144c32d6b57917a27f4a35d..ea5b847eab383960733e9378ff6b2e35238a7184 100644 (file)
@@ -30,6 +30,7 @@
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
+#include <math.h>
 #include <stdlib.h>
 #include <time.h>
 #ifndef _WIN32
@@ -645,7 +646,7 @@ void dumpstat(graph_t * g)
            dx = ND_pos(np)[0] - ND_pos(aghead(ep))[0];
            dy = ND_pos(np)[1] - ND_pos(aghead(ep))[1];
            fprintf(stderr, "  %s --  %s  (%f)\n", agnameof(np),
-                   agnameof(aghead(ep)), sqrt(dx * dx + dy * dy));
+                   agnameof(aghead(ep)), hypot(dx, dy));
        }
     }
 }