您的位置:首页 > 编程语言 > Python开发

python -mtimeit in windows

2010-06-04 23:52 483 查看
$ python -mtimeit -s"from math import sqrt; x = 123" "x**.5" 
1000000 loops, best of 3: 0.445 usec per loop 
 
$ python -mtimeit -s"from math import sqrt; x = 123" "sqrt(x)" 
1000000 loops, best of 3: 0.574 usec per loop 
 
$ python -mtimeit -s"import math; x = 123" "math.sqrt(x)" 
1000000 loops, best of 3: 0.727 usec per loop 

 

from http://stackoverflow.com/questions/842245/which-is-more-accurate-x-5-or-math-sqrtx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息