From daf1967114682b1b9311648700e34d6465cb3f69 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 1 Jan 2023 16:14:33 -0800 Subject: [PATCH] sparse Multilevel_Modularity_Clustering_init: rephrase 'deg_total' clamping Squashes a -Wfloat-equal warning. --- lib/sparse/clustering.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/sparse/clustering.c b/lib/sparse/clustering.c index 94902f136..c3cd6618c 100644 --- a/lib/sparse/clustering.c +++ b/lib/sparse/clustering.c @@ -9,6 +9,7 @@ *************************************************************************/ #define STANDALONE +#include #include #include #include @@ -58,7 +59,7 @@ static Multilevel_Modularity_Clustering Multilevel_Modularity_Clustering_init(Sp } deg_total += deg[i]; } - if (deg_total == 0) deg_total = 1; + deg_total = fmax(deg_total, 1); for (i = 0; i < n; i++){ modularity += (indeg[i] - deg[i]*deg[i]/deg_total)/deg_total; } -- 2.40.0