Minor improvement to code clarity (GH-9036)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Sun, 2 Sep 2018 20:34:21 +0000 (13:34 -0700)
committerGitHub <noreply@github.com>
Sun, 2 Sep 2018 20:34:21 +0000 (13:34 -0700)
Make it clear that the n==0 case is included. Otherwise, you have to know that max==0.0 whenever n==0.

Modules/mathmodule.c

index 8015a95d2aa74624a9efc7add37af60a621d790f..06a969cebacb29561da605be4d4e9f1c77f6f861 100644 (file)
@@ -2074,7 +2074,7 @@ vector_norm(Py_ssize_t n, double *vec, double max, int found_nan)
     if (found_nan) {
         return Py_NAN;
     }
-    if (max == 0.0 || n == 1) {
+    if (max == 0.0 || n <= 1) {
         return max;
     }
     for (i=0 ; i < n ; i++) {