summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2018-09-02 20:34:21 (GMT)
committerGitHub <noreply@github.com>2018-09-02 20:34:21 (GMT)
commitf3267144269b873bcb87a9fcafe94b37be1bcfdc (patch)
treef6241e4e49f200a0b9269e8a919b315a1a9e2652
parent98b976a2f82ba5f50cf6846338f644ca6c64f47d (diff)
downloadcpython-f3267144269b873bcb87a9fcafe94b37be1bcfdc.zip
cpython-f3267144269b873bcb87a9fcafe94b37be1bcfdc.tar.gz
cpython-f3267144269b873bcb87a9fcafe94b37be1bcfdc.tar.bz2
Minor improvement to code clarity (GH-9036)
Make it clear that the n==0 case is included. Otherwise, you have to know that max==0.0 whenever n==0.
-rw-r--r--Modules/mathmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 8015a95..06a969c 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -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++) {