From 1cd4f6cf0fd8fa1c815829ac4672604c933e4180 2010-04-25 22:56:00 From: David Warde-Farley Date: 2010-04-25 22:56:00 Subject: [PATCH] Fix %timeit reporting when the time is longer than 1000s. Patch by David Warde-Farley https://bugs.launchpad.net/ipython/+bug/409566 --- diff --git a/IPython/core/magic.py b/IPython/core/magic.py index ae37208..21a817a 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -1953,8 +1953,10 @@ Currently the magic system has the following functions:\n""" best = min(timer.repeat(repeat, number)) / number - if best > 0.0: + if best > 0.0 and best < 1000.0: order = min(-int(math.floor(math.log10(best)) // 3), 3) + elif best >= 1000.0: + order = 0 else: order = 3 print u"%d loops, best of %d: %.*g %s per loop" % (number, repeat,