aboutsummaryrefslogtreecommitdiffstats
path: root/benchmark
diff options
context:
space:
mode:
authorYaw Boakye <wheresyaw@gmail.com>2018-10-12 02:04:46 +0200
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-05 09:04:32 +0900
commit6bb3618f281e1cdbb28fe38ee88287da9b1838e8 (patch)
tree88c86a9cb4bfbf882050a4e13f2dcc616052a63e /benchmark
parent253da5b2196ccef2a2bf66ca4e7305118f79198a (diff)
downloadruby-6bb3618f281e1cdbb28fe38ee88287da9b1838e8.tar.gz
n+1 to include n in range
Python's range stop right before n, which means factL never returns the correct result. Closes: https://github.com/ruby/ruby/pull/1982
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/other-lang/fact.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/benchmark/other-lang/fact.py b/benchmark/other-lang/fact.py
index 01593965d9..1ce9f76275 100644
--- a/benchmark/other-lang/fact.py
+++ b/benchmark/other-lang/fact.py
@@ -3,7 +3,7 @@
def factL(n):
r = 1
- for x in range(2, n):
+ for x in range(2, n+1):
r *= x
return r