Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorJames Cameron <quozl@laptop.org>2011-08-24 21:53:44 (GMT)
committer James Cameron <quozl@laptop.org>2011-08-24 21:53:44 (GMT)
commitc5083f5990103783730ff64c63a22867d8db9110 (patch)
tree3df53b37ea960e75d5b53934606d61212920373d /data
parent5e9348bf2a80d04fa96b78e1759feb06e401e38a (diff)
division by zero fix for when elapsed time is zero on fast systems, #11176
Diffstat (limited to 'data')
-rw-r--r--data/math/factorial5
1 files changed, 4 insertions, 1 deletions
diff --git a/data/math/factorial b/data/math/factorial
index c5b9ce7..95d0cd4 100644
--- a/data/math/factorial
+++ b/data/math/factorial
@@ -29,7 +29,10 @@ def calculate(number, type):
type_s = 'iterative'
factorial_iterative(number)
delta = time.time() - start
- print 'Type: ', type_s, ' in: ', 1 / delta
+ if delta > 0:
+ print 'Type: ', type_s, ' in: ', 1 / delta
+ else:
+ print 'Type: ', type_s
# ask for a number to compute the factorial of
number = input('Please input a number:')