~ipython-dev/ipython/trunk

« back to all changes in this revision

Viewing changes to IPython/core/magic.py

  • Committer: Fernando Perez
  • Author(s): David Warde-Farley
  • Date: 2010-04-25 22:56:00 UTC
  • Revision ID: fernando.perez@berkeley.edu-20100425225600-netfepyrqwipumys
Fix %timeit reporting when the time is longer than 1000s.

Patch by David Warde-Farley

https://bugs.launchpad.net/ipython/+bug/409566

Show diffs side-by-side

added added

removed removed

Lines of Context:
1953
1953
        
1954
1954
        best = min(timer.repeat(repeat, number)) / number
1955
1955
 
1956
 
        if best > 0.0:
 
1956
        if best > 0.0 and best < 1000.0:
1957
1957
            order = min(-int(math.floor(math.log10(best)) // 3), 3)
 
1958
        elif best >= 1000.0:
 
1959
            order = 0
1958
1960
        else:
1959
1961
            order = 3
1960
1962
        print u"%d loops, best of %d: %.*g %s per loop" % (number, repeat,