diff options
author | James Cameron <quozl@laptop.org> | 2011-08-24 21:53:44 (GMT) |
---|---|---|
committer | James Cameron <quozl@laptop.org> | 2011-08-24 21:53:44 (GMT) |
commit | c5083f5990103783730ff64c63a22867d8db9110 (patch) | |
tree | 3df53b37ea960e75d5b53934606d61212920373d | |
parent | 5e9348bf2a80d04fa96b78e1759feb06e401e38a (diff) |
division by zero fix for when elapsed time is zero on fast systems, #11176
-rw-r--r-- | data/math/factorial | 5 |
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:') |