Python论坛  - 讨论区

标题:[python-chinese] 浮点运算快于整形?!

2006年09月27日 星期三 17:45

Linker Lin linkerlin88在gmail.com
星期三 九月 27 17:45:01 HKT 2006

.æÊØhŸn7Šjh®Ûb™è­¶Ø¦z+SŠg«×ßu÷ÔëiǛiÉ&¢ËkyǧµÆ¥–V¬´X¥z)íz¶œ¶+ފzn¶X§{X§)^ü­†‰öป¶)žŠÚr–)Þ×]¢ž)â¶Ëf¶·¢×§¶Ëf·Áb•àÊØhŸn‰»b™è­§)bïuŠzފw^žÚÞ¶êç²·+z™Zqéçú)Ýz{@¶Úânë^ºè®)í¡¸ÞrØZ²z¶Úânë^­êeiÇ­¶)žŠÔâ™êõ÷Ý}öÛb™è­Ó~´ãŽöÓ¾»çÍùóËmŠg¢¶{¦mê

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月27日 星期三 17:55

Kasicass kasicass在gmail.com
星期三 九月 27 17:55:38 HKT 2006

Hi Linker Lin:

因为现代的 CPU 都有专门的 FPU(Float-Process-Unit),float 运算都是其专门 
负责的。


Linker Lin 写道:
> Lua的教程说浮点运算快于整形,拿Python2.4.3试了一下.
> 果然!
> 
>  >>> import timeit
>  >>> t = timeit.Timer(199*199)
> Traceback (most recent call last):
> File "", line 1, in ?
> File "C:\Python24\Lib\timeit.py", line 112, in __init__
> stmt = reindent(stmt, 8)
> File "C:\Python24\Lib\timeit.py", line 91, in reindent
> return src.replace("\n", "\n" + " "*indent)
> AttributeError: 'int' object has no attribute 'replace'
>  >>> t = timeit.Timer('199*199')
>  >>> t.timeit()
> 0.36044720767583588
>  >>> t.timeit(number=1000*1000*20)
> 3.6867537633973058
>  >>> t2 = 
> timeit.Timer('199.91232423424324324343*199.23234324342424324342423342342')
>  >>> t .timeit(number=1000*1000*20)
> 3.6714054439879931
>  >>> t2.timeit(number=1000*1000*20)
> 3.1206189613484412
>  >>> t2.timeit(number=1000*1000*20)
> 3.1865454967041984
>  >>> t.timeit(number=1000*1000*100)
> 18.426665120846394
>  >>> t2.timeit(number=1000*1000*100)
> 15.981540391306737
>  >>> t2.timeit(number=1000*1000*100)
> 16.431484448442404
>  >>> t2.timeit(number=1000*1000*100)
> 16.100137587319068
>  >>> t.timeit(number=1000*1000*100)
> 18.39941975865645
>  >>> t.timeit(number=1000*1000*100)
> 18.368376986460589
>  >>>
> 
> 谁能解释一下?
> 
> -- 
> Linker M Lin
> linkerlin88在gmail.com linkerlin88在gmail.com>
> linker.m.lin在gmail.com linker.m.lin在gmail.com>
>   ※※※※※※※※※
>   ※※我思故我在※※
>   ※※※※※※※※※
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


-- 
Best regards!

Kasicass/sYcini - Coder
http://www.sycini.com


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月27日 星期三 17:58

cat street gamcat在gmail.com
星期三 九月 27 17:58:10 HKT 2006

ÛM:ÿßö즬‰Æ¬²F¬‰Æ¬²	šŠW(˜x‹Šy¬¸§õ=Ae¡«O®‡²Å'Š×å¡«KŠy¬¸§.æÊØhŸn7Šjh®Ûb™è­¶Ø¦z+SŠg«×ßu÷ÔëiǛiÉ&¢ËkyǧµÆ¥–V¬´X¥z)íz¶œ¶+ފzn¶X§{X§)^ü­†‰öป¶)žŠÚr–)Þ×]¢ž)â¶Ëf¶·¢×§¶Ëf·Áb•àÊØhŸn‰»b™è­§)bïuŠzފw^žÚÞ¶êç²·+z™Zqéçú)Ýz{@¶Úânë^ºè®)í¡¸ÞrØZ²z¶Úânë^­êeiÇ­¶)žŠÔâ™êõ÷Ý}öÛb™è­Ó~´ãŽöÓ¾»çÍùóËmŠg¢¶{¦mê

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月27日 星期三 18:01

Linker Lin linkerlin88在gmail.com
星期三 九月 27 18:01:18 HKT 2006

¶)žŠÔâ™êõÓ]mŠg¢·5óo8㎻뭻ó«b™è­N)ž¯]5Ûm¶Ûm¶Ûm¶Ûm¶Ûm¶Ûmµ×}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}øç®üöئz+tëÍ4óÏx÷Îvç®5òئz+SŠg«×MvÛm¶Ûm¶Ûm¶Ûm¶Ûm¶Ûmuß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß~9ë¿=¶)žŠÝ;×}½ï­ýïÍüۏ<¶)žŠÔâ™êõÓ]mŠg¢·9ïn·ãmõãŽz×Ó§÷ý»ÿNŠjȜjË$jȜjË ™¨¥r‰°®‹^"âžG«.)Â=AOPYhjÓë¡Ç¬±IâµùhjÒâžG«.)˹£ò¶'ۍ⚚+¶Ø¦z+m¶)žŠÔâ™êõ÷Ý}õ:ÚqæÚrI¨²ÚÞqéíq©e•«-)^Š{^­§-Š÷¢ž›­–)ÞÖ)ŊW‚?+a¢}¸.&íŠg¢¶œ¥Šwµ×h§Šx­²Ù­­è§uéí²Ù­ðX¥x#ò¶'ۂânئz+iÊX§{Ýbž·¢×§¶·­º¹ì­ÊÞ¦VœzyþŠw^žÐ-¶¸›º×„®º+Š{hn7œ¶¬ž†­¶¸›º×«z™Zqë

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月27日 星期三 18:03

Linker Lin linkerlin88在gmail.com
星期三 九月 27 18:03:01 HKT 2006

–‰à×NuÓM4ÓM4ÓM×NuÓM4Òئz+SŠg«×NmŠg¢·MüÛ~tç5ßÞønŸßöïý:.)äz²âžX§‘êåŠ<‚f¢•Ê&º-zئz+SŠg«×Mu¶)žŠÞ4×ͼãŽ:﮶ï݊g¢µ8¦z½t×m¶Ûm¶Ûm¶Ûm¶Ûm¶Ûm¶×]÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷㞻óÛb™è­Ó¯4ÓÏ=ãß9۞¸×Ëb™è­N)ž¯]5Ûm¶Ûm¶Ûm¶Ûm¶Ûm¶Ûmµ×}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}÷ß}øç®üöئz+tï]ö÷¾·÷¿7ón<òئz+SŠg«×Mu¶)žŠÞ4罺ߍ·×Ž9ë_NŸßöïý:)«"q«,‘«"q«,‚f¢•Ê&º-xx‹Šy¬¸§õ=Ae¡«O®‡²Å'Š×å¡«KŠy¬¸§.æÊØhŸn7Šjh®Ûb™è­¶Ø¦z+SŠg«×ßu÷ÔëiǛiÉ&¢ËkyǧµÆ¥–V¬´X¥z)íz¶œ¶+ފzn¶X§{X§)^ü­†‰öป¶)žŠÚr–)Þ×]¢ž)â¶Ëf¶·¢×§¶Ëf·Áb•àÊØhŸn‰»b™è­§)bïuŠzފw^žÚÞ¶êç²·+z™Zqéçú)Ýz{@¶Úânë^ºè®)í¡¸ÞrØZ²z¶Úânë^­êeiÇ­¶)žŠÔâ™êõ÷Ý}öÛb™è­Ó~´ãŽöÓ¾»çÍùóËmŠg¢¶{¦mê

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月27日 星期三 18:03

Kasicass kasicass在gmail.com
星期三 九月 27 18:03:27 HKT 2006

Hi cat street:

应该是吧,各种语言到多都是 C 实现的,下面的 float 运算最后还是归给 C
做,自然就是操作系统做了。。那自然就是 FPU 做了。

语言本身实现 float 运算,不是很麻烦有低效么?

cat street 写道:
> 这么说任何语言都如此了?
> 
> 2006/9/27, Kasicass <kasicass在gmail.com kasicass在gmail.com>>:
> 
>     Hi Linker Lin:
> 
>     因为现代的 CPU 都有专门的 FPU(Float-Process-Unit),float 运算都是其专门
>     负责的。
> 
> 
>     Linker Lin 写道:
>      > Lua的教程说浮点运算快于整形,拿Python2.4.3试了一下.
>      > 果然!
>      >
>      >  >>> import timeit
>      >  >>> t = timeit.Timer(199*199)
>      > Traceback (most recent call last):
>      > File "", line 1, in ?
>      > File "C:\Python24\Lib\timeit.py", line 112, in __init__
>      > stmt = reindent(stmt, 8)
>      > File "C:\Python24\Lib\timeit.py", line 91, in reindent
>      > return src.replace("\n", "\n" + " "*indent)
>      > AttributeError: 'int' object has no attribute 'replace'
>      >  >>> t = timeit.Timer('199*199')
>      >  >>> t.timeit()
>      > 0.36044720767583588
>      >  >>> t.timeit(number=1000*1000*20)
>      > 3.6867537633973058
>      >  >>> t2 =
>      >
>     timeit.Timer('199.91232423424324324343*199.23234324342424324342423342342')
>      >  >>> t .timeit(number=1000*1000*20)
>      > 3.6714054439879931
>      >  >>> t2.timeit(number=1000*1000*20)
>      > 3.1206189613484412
>      >  >>> t2.timeit(number=1000*1000*20)
>      > 3.1865454967041984
>      >  >>> t.timeit(number=1000*1000*100)
>      > 18.426665120846394
>      >  >>> t2.timeit(number=1000*1000*100)
>      > 15.981540391306737
>      >  >>> t2.timeit(number=1000*1000*100)
>      > 16.431484448442404
>      >  >>> t2.timeit(number=1000*1000*100)
>      > 16.100137587319068
>      >  >>> t.timeit(number=1000*1000*100)
>      > 18.39941975865645
>      >  >>> t.timeit(number=1000*1000*100)
>      > 18.368376986460589
>      >  >>>
>      >
>      > 谁能解释一下?
>      >
>      > --
>      > Linker M Lin
>      > linkerlin88在gmail.com linkerlin88在gmail.com>
>     linkerlin88在gmail.com linkerlin88在gmail.com>>
>      > linker.m.lin在gmail.com linker.m.lin在gmail.com>
>     linker.m.lin在gmail.com linker.m.lin在gmail.com>>
>      >   ※※※※※※※※※
>      >   ※※我思故我在※※
>      >   ※※※※※※※※※
>      >
>      >
>      >
>     ------------------------------------------------------------------------
> 
>      >
>      > _______________________________________________
>      > python-chinese
>      > Post: send python-chinese在lists.python.cn
>     python-chinese在lists.python.cn>
>      > Subscribe: send subscribe to
>     python-chinese-request在lists.python.cn
>     python-chinese-request在lists.python.cn>
>      > Unsubscribe: send unsubscribe
>     to  python-chinese-request在lists.python.cn
>     python-chinese-request在lists.python.cn>
>      > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> 
> 
>     --
>     Best regards!
> 
>     Kasicass/sYcini - Coder
>     http://www.sycini.com
> 
>     _______________________________________________
>     python-chinese
>     Post: send python-chinese在lists.python.cn
>     python-chinese在lists.python.cn>
>     Subscribe: send subscribe to python-chinese-request在lists.python.cn
>     python-chinese-request在lists.python.cn>
>     Unsubscribe: send unsubscribe
>     to  python-chinese-request在lists.python.cn
>     python-chinese-request在lists.python.cn>
>     Detail Info: http://python.cn/mailman/listinfo/python-chinese
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


-- 
Best regards!

Kasicass/sYcini - Coder
http://www.sycini.com


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月27日 星期三 18:19

cat street gamcat在gmail.com
星期三 九月 27 18:19:11 HKT 2006

Ô­À´ÊÇÕâÑù,ÎÒ»¹µ£ÐÄOPENGLΪɶÓÃÕâô¶àµÄfloat:)

2006/9/27, Kasicass <kasicass在gmail.com>:
>
> Hi cat street:
>
> Ó¦¸ÃÊÇ°É£¬¸÷ÖÖÓïÑÔµ½¶à¶¼ÊÇ C ʵÏֵģ¬ÏÂÃæµÄ float ÔËËã×îºó»¹Êǹé¸ø C
> ×ö£¬×ÔÈ»¾ÍÊDzÙ×÷ϵͳ×öÁË¡£¡£ÄÇ×ÔÈ»¾ÍÊÇ FPU ×öÁË¡£
>
> ÓïÑÔ±¾ÉíʵÏÖ float ÔËË㣬²»ÊǺÜÂé·³ÓеÍЧô£¿
>
> cat street дµÀ:
> > Õâô˵ÈκÎÓïÑÔ¶¼Èç´ËÁË?
> >
> > 2006/9/27, Kasicass <kasicass在gmail.com kasicass在gmail.com>>:
> >
> >     Hi Linker Lin£º
> >
> >     ÒòΪÏÖ´úµÄ CPU ¶¼ÓÐרÃÅµÄ FPU(Float-Process-Unit)£¬float ÔËË㶼ÊÇÆäרÃÅ
> >     ¸ºÔðµÄ¡£
> >
> >
> >     Linker Lin дµÀ:
> >      > LuaµÄ½Ì³Ì˵¸¡µãÔËËã¿ìÓÚÕûÐÎ,ÄÃPython2.4.3ÊÔÁËÒ»ÏÂ.
> >      > ¹ûÈ»!
> >      >
> >      >  >>> import timeit
> >      >  >>> t = timeit.Timer(199*199)
> >      > Traceback (most recent call last):
> >      > File "", line 1, in ?
> >      > File "C:\Python24\Lib\timeit.py", line 112, in __init__
> >      > stmt = reindent(stmt, 8)
> >      > File "C:\Python24\Lib\timeit.py", line 91, in reindent
> >      > return src.replace("\n", "\n" + " "*indent)
> >      > AttributeError: 'int' object has no attribute 'replace'
> >      >  >>> t = timeit.Timer('199*199')
> >      >  >>> t.timeit()
> >      > 0.36044720767583588
> >      >  >>> t.timeit(number=1000*1000*20)
> >      > 3.6867537633973058
> >      >  >>> t2 =
> >      >
> >     timeit.Timer('
> 199.91232423424324324343*199.23234324342424324342423342342')
> >      >  >>> t .timeit(number=1000*1000*20)
> >      > 3.6714054439879931
> >      >  >>> t2.timeit(number=1000*1000*20)
> >      > 3.1206189613484412
> >      >  >>> t2.timeit(number=1000*1000*20)
> >      > 3.1865454967041984
> >      >  >>> t.timeit(number=1000*1000*100)
> >      > 18.426665120846394
> >      >  >>> t2.timeit(number=1000*1000*100)
> >      > 15.981540391306737
> >      >  >>> t2.timeit(number=1000*1000*100)
> >      > 16.431484448442404
> >      >  >>> t2.timeit(number=1000*1000*100)
> >      > 16.100137587319068
> >      >  >>> t.timeit(number=1000*1000*100)
> >      > 18.39941975865645
> >      >  >>> t.timeit(number=1000*1000*100)
> >      > 18.368376986460589
> >      >  >>>
> >      >
> >      > Ë­ÄܽâÊÍÒ»ÏÂ?
> >      >
> >      > --
> >      > Linker M Lin
> >      > linkerlin88在gmail.com linkerlin88在gmail.com>
> >     linkerlin88在gmail.com linkerlin88在gmail.com>>
> >      > linker.m.lin在gmail.com linker.m.lin在gmail.com>
> >     linker.m.lin在gmail.com linker.m.lin在gmail.com>>
> >      >   ¡ù¡ù¡ù¡ù¡ù¡ù¡ù¡ù¡ù
> >      >   ¡ù¡ùÎÒ˼¹ÊÎÒÔÚ¡ù¡ù
> >      >   ¡ù¡ù¡ù¡ù¡ù¡ù¡ù¡ù¡ù
> >      >
> >      >
> >      >
> >
> ------------------------------------------------------------------------
> >
> >      >
> >      > _______________________________________________
> >      > python-chinese
> >      > Post: send python-chinese在lists.python.cn
> >     python-chinese在lists.python.cn>
> >      > Subscribe: send subscribe to
> >     python-chinese-request在lists.python.cn
> >     python-chinese-request在lists.python.cn>
> >      > Unsubscribe: send unsubscribe
> >     to  python-chinese-request在lists.python.cn
> >     python-chinese-request在lists.python.cn>
> >      > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >     --
> >     Best regards£¡
> >
> >     Kasicass/sYcini - Coder
> >     http://www.sycini.com
> >
> >     _______________________________________________
> >     python-chinese
> >     Post: send python-chinese在lists.python.cn
> >     python-chinese在lists.python.cn>
> >     Subscribe: send subscribe to python-chinese-request在lists.python.cn
> >     python-chinese-request在lists.python.cn>
> >     Unsubscribe: send unsubscribe
> >     to  python-chinese-request在lists.python.cn
> >     python-chinese-request在lists.python.cn>
> >     Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> --
> Best regards£¡
>
> Kasicass/sYcini - Coder
> http://www.sycini.com
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20060927/d6e2905f/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月27日 星期三 23:13

falls huang falls.huang在gmail.com
星期三 九月 27 23:13:21 HKT 2006

现在的CPU有很多种,PC上的x86/ia64/amd64  当然都是有fpu的。

不过嵌入式系统像智能手机和PDA上,很多都没有fpu 。

2006/9/27, Kasicass <kasicass在gmail.com>:
> Hi Linker Lin:
>
> 因为现代的 CPU 都有专门的 FPU(Float-Process-Unit),float 运算都是其专门
> 负责的。
>


-- 
Regards
Falls Huang

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月28日 星期四 08:19

风尘无限 tianyu263在163.com
星期四 九月 28 08:19:15 HKT 2006

Linker Lin:

	在 python 2.5 下,没有什么区别。

E:\Programs>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> timeit.Timer('10**11').timeit()
0.16993025649908017
>>> timeit.Timer('10.234**11.222').timeit()
0.17035014226668488
>>> exit()

        致
礼!
 
				 
        风尘无限
               Bejing HATL Information Technology Co. Ltd.
        tianyu263在163.com
          2006-09-28 08:18:03

= = = = = = = = = = = = = = = = = = = =
======= 2006-09-27 18:01:32 您在来信中写道:=======

>看这个差距就更大了!
>>>> timeit.Timer('10**11').timeit()
>4.0182844467662786
>>>> timeit.Timer('
>10.122222222222222222222222**11.3333333333333333333333333333333333456789'
>).timeit()
>0.68008894985256418
>>>> timeit.Timer('
>10.122222222222222222222222**11.3333333333333333333333333333333333456789'
>).timeit()
>0.71329763978382488
>>>> timeit.Timer('10**11').timeit()
>4.0572634231445619
>
>
>On 9/27/06, Kasicass <kasicass在gmail.com> wrote:
>>
>> Hi Linker Lin:
>>
>> 因为现代的 CPU 都有专门的 FPU(Float-Process-Unit),float 运算都是其专门
>> 负责的。
>>
>>
>> Linker Lin 写道:
>> > Lua的教程说浮点运算快于整形,拿Python2.4.3试了一下.
>> > 果然!
>> >
>> >  >>> import timeit
>> >  >>> t = timeit.Timer(199*199)
>> > Traceback (most recent call last):
>> > File "", line 1, in ?
>> > File "C:\Python24\Lib\timeit.py", line 112, in __init__
>> > stmt = reindent(stmt, 8)
>> > File "C:\Python24\Lib\timeit.py", line 91, in reindent
>> > return src.replace("\n", "\n" + " "*indent)
>> > AttributeError: 'int' object has no attribute 'replace'
>> >  >>> t = timeit.Timer('199*199')
>> >  >>> t.timeit()
>> > 0.36044720767583588
>> >  >>> t.timeit(number=1000*1000*20)
>> > 3.6867537633973058
>> >  >>> t2 =
>> > timeit.Timer('
>> 199.91232423424324324343*199.23234324342424324342423342342')
>> >  >>> t .timeit(number=1000*1000*20)
>> > 3.6714054439879931
>> >  >>> t2.timeit(number=1000*1000*20)
>> > 3.1206189613484412
>> >  >>> t2.timeit(number=1000*1000*20)
>> > 3.1865454967041984
>> >  >>> t.timeit(number=1000*1000*100)
>> > 18.426665120846394
>> >  >>> t2.timeit(number=1000*1000*100)
>> > 15.981540391306737
>> >  >>> t2.timeit(number=1000*1000*100)
>> > 16.431484448442404
>> >  >>> t2.timeit(number=1000*1000*100)
>> > 16.100137587319068
>> >  >>> t.timeit(number=1000*1000*100)
>> > 18.39941975865645
>> >  >>> t.timeit(number=1000*1000*100)
>> > 18.368376986460589
>> >  >>>
>> >
>> > 谁能解释一下?
>> >
>> > --
>> > Linker M Lin
>> > linkerlin88在gmail.com linkerlin88在gmail.com>
>> > linker.m.lin在gmail.com linker.m.lin在gmail.com>
>> >   ※※※※※※※※※
>> >   ※※我思故我在※※
>> >   ※※※※※※※※※
>> >
>> >
>> > ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > python-chinese
>> > Post: send python-chinese在lists.python.cn
>> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
>> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>>
>>
>> --
>> Best regards!
>>
>> Kasicass/sYcini - Coder
>> http://www.sycini.com
>>
>> _______________________________________________
>> python-chinese
>> Post: send python-chinese在lists.python.cn
>> Subscribe: send subscribe to python-chinese-request在lists.python.cn
>> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
>-- 
>Linker M Lin
>linkerlin88在gmail.com
>linker.m.lin在gmail.com
>  ※※※※※※※※※
>  ※※我思故我在※※
>  ※※※※※※※※※
>_______________________________________________
>python-chinese
>Post: send python-chinese在lists.python.cn
>Subscribe: send subscribe to python-chinese-request在lists.python.cn
>Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>Detail Info: http://python.cn/mailman/listinfo/python-chinese




[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月28日 星期四 09:17

lu lubiao.py在gmail.com
星期四 九月 28 09:17:09 HKT 2006

timeit.Timer('10.234**11.222').timeit()

用一个 for 循环啊,
就计算 一次 能看出啥 区别

On 9/28/06, 风尘无限 <tianyu263 at 163.com> wrote:
> Linker Lin:
>
>        在 python 2.5 下,没有什么区别。
>
> E:\Programs>python
> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import timeit
> >>> timeit.Timer('10**11').timeit()
> 0.16993025649908017
> >>> timeit.Timer('10.234**11.222').timeit()
> 0.17035014226668488
> >>> exit()
>
>> 礼!
>
>
> 风尘无限
>               Bejing HATL Information Technology Co. Ltd.
> tianyu263 at 163.com
> 2006-09-28 08:18:03
>
> = = = = = = = = = = = = = = = = = = = =
> ======= 2006-09-27 18:01:32 您在来信中写道:=======
>
> >看这个差距就更大了!
> >>>> timeit.Timer('10**11').timeit()
> >4.0182844467662786
> >>>> timeit.Timer('
> >10.122222222222222222222222**11.3333333333333333333333333333333333456789'
> >).timeit()
> >0.68008894985256418
> >>>> timeit.Timer('
> >10.122222222222222222222222**11.3333333333333333333333333333333333456789'
> >).timeit()
> >0.71329763978382488
> >>>> timeit.Timer('10**11').timeit()
> >4.0572634231445619
> >
> >
> >On 9/27/06, Kasicass <kasicass at gmail.com> wrote:
> >>
> >> Hi Linker Lin:
> >>
> >> 因为现代的 CPU 都有专门的 FPU(Float-Process-Unit),float 运算都是其专门
> >> 负责的。
> >>
> >>
> >> Linker Lin 写道:
> >> > Lua的教程说浮点运算快于整形,拿Python2.4.3试了一下.
> >> > 果然!
> >> >
> >> >  >>> import timeit
> >> >  >>> t = timeit.Timer(199*199)
> >> > Traceback (most recent call last):
> >> > File "", line 1, in ?
> >> > File "C:\Python24\Lib\timeit.py", line 112, in __init__
> >> > stmt = reindent(stmt, 8)
> >> > File "C:\Python24\Lib\timeit.py", line 91, in reindent
> >> > return src.replace("\n", "\n" + " "*indent)
> >> > AttributeError: 'int' object has no attribute 'replace'
> >> >  >>> t = timeit.Timer('199*199')
> >> >  >>> t.timeit()
> >> > 0.36044720767583588
> >> >  >>> t.timeit(number=1000*1000*20)
> >> > 3.6867537633973058
> >> >  >>> t2 =
> >> > timeit.Timer('
> >> 199.91232423424324324343*199.23234324342424324342423342342')
> >> >  >>> t .timeit(number=1000*1000*20)
> >> > 3.6714054439879931
> >> >  >>> t2.timeit(number=1000*1000*20)
> >> > 3.1206189613484412
> >> >  >>> t2.timeit(number=1000*1000*20)
> >> > 3.1865454967041984
> >> >  >>> t.timeit(number=1000*1000*100)
> >> > 18.426665120846394
> >> >  >>> t2.timeit(number=1000*1000*100)
> >> > 15.981540391306737
> >> >  >>> t2.timeit(number=1000*1000*100)
> >> > 16.431484448442404
> >> >  >>> t2.timeit(number=1000*1000*100)
> >> > 16.100137587319068
> >> >  >>> t.timeit(number=1000*1000*100)
> >> > 18.39941975865645
> >> >  >>> t.timeit(number=1000*1000*100)
> >> > 18.368376986460589
> >> >  >>>
> >> >
> >> > 谁能解释一下?
> >> >
> >> > --
> >> > Linker M Lin
> >> > linkerlin88 at gmail.com linkerlin88 at gmail.com>
> >> > linker.m.lin at gmail.com linker.m.lin at gmail.com>
> >> >   ※※※※※※※※※
> >> >   ※※我思故我在※※
> >> >   ※※※※※※※※※
> >> >
> >> >
> >> > ------------------------------------------------------------------------
> >> >
> >> > _______________________________________________
> >> > python-chinese
> >> > Post: send python-chinese at lists.python.cn
> >> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> >> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >>
> >>
> >> --
> >> Best regards!
> >>
> >> Kasicass/sYcini - Coder
> >> http://www.sycini.com
> >>
> >> _______________________________________________
> >> python-chinese
> >> Post: send python-chinese at lists.python.cn
> >> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >
> >
> >--
> >Linker M Lin
> >linkerlin88 at gmail.com
> >linker.m.lin at gmail.com
> >  ※※※※※※※※※
> >  ※※我思故我在※※
> >  ※※※※※※※※※
> >_______________________________________________
> >python-chinese
> >Post: send python-chinese at lists.python.cn
> >Subscribe: send subscribe to python-chinese-request at lists.python.cn
> >Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> >Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年09月28日 星期四 21:48

风尘无限 tianyu263在163.com
星期四 九月 28 21:48:42 HKT 2006

lu:

	大家可以在2.4.3下试试,不用FOR循环,也能看出较大的区别。

        致
礼!
 
				 
        风尘无限
               Bejing HATL Information Technology Co. Ltd.
        tianyu263在163.com
          2006-09-28 21:47:50

= = = = = = = = = = = = = = = = = = = =
======= 2006-09-28 09:17:27 您在来信中写道:=======

>timeit.Timer('10.234**11.222').timeit()
>
>用一个 for 循环啊,
>就计算 一次 能看出啥 区别
>
>On 9/28/06, 风尘无限 <tianyu263在163.com> wrote:
>> Linker Lin:
>>
>>        在 python 2.5 下,没有什么区别。
>>
>> E:\Programs>python
>> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import timeit
>> >>> timeit.Timer('10**11').timeit()
>> 0.16993025649908017
>> >>> timeit.Timer('10.234**11.222').timeit()
>> 0.17035014226668488
>> >>> exit()
>>
>>>> 礼!
>>
>>
>> 风尘无限
>>               Bejing HATL Information Technology Co. Ltd.
>> tianyu263在163.com
>> 2006-09-28 08:18:03
>>
>> = = = = = = = = = = = = = = = = = = = =
>> ======= 2006-09-27 18:01:32 您在来信中写道:=======
>>
>> >看这个差距就更大了!
>> >>>> timeit.Timer('10**11').timeit()
>> >4.0182844467662786
>> >>>> timeit.Timer('
>> >10.122222222222222222222222**11.3333333333333333333333333333333333456789'
>> >).timeit()
>> >0.68008894985256418
>> >>>> timeit.Timer('
>> >10.122222222222222222222222**11.3333333333333333333333333333333333456789'
>> >).timeit()
>> >0.71329763978382488
>> >>>> timeit.Timer('10**11').timeit()
>> >4.0572634231445619
>> >
>> >
>> >On 9/27/06, Kasicass <kasicass在gmail.com> wrote:
>> >>
>> >> Hi Linker Lin:
>> >>
>> >> 因为现代的 CPU 都有专门的 FPU(Float-Process-Unit),float 运算都是其专门
>> >> 负责的。
>> >>
>> >>
>> >> Linker Lin 写道:
>> >> > Lua的教程说浮点运算快于整形,拿Python2.4.3试了一下.
>> >> > 果然!
>> >> >
>> >> >  >>> import timeit
>> >> >  >>> t = timeit.Timer(199*199)
>> >> > Traceback (most recent call last):
>> >> > File "", line 1, in ?
>> >> > File "C:\Python24\Lib\timeit.py", line 112, in __init__
>> >> > stmt = reindent(stmt, 8)
>> >> > File "C:\Python24\Lib\timeit.py", line 91, in reindent
>> >> > return src.replace("\n", "\n" + " "*indent)
>> >> > AttributeError: 'int' object has no attribute 'replace'
>> >> >  >>> t = timeit.Timer('199*199')
>> >> >  >>> t.timeit()
>> >> > 0.36044720767583588
>> >> >  >>> t.timeit(number=1000*1000*20)
>> >> > 3.6867537633973058
>> >> >  >>> t2 =
>> >> > timeit.Timer('
>> >> 199.91232423424324324343*199.23234324342424324342423342342')
>> >> >  >>> t .timeit(number=1000*1000*20)
>> >> > 3.6714054439879931
>> >> >  >>> t2.timeit(number=1000*1000*20)
>> >> > 3.1206189613484412
>> >> >  >>> t2.timeit(number=1000*1000*20)
>> >> > 3.1865454967041984
>> >> >  >>> t.timeit(number=1000*1000*100)
>> >> > 18.426665120846394
>> >> >  >>> t2.timeit(number=1000*1000*100)
>> >> > 15.981540391306737
>> >> >  >>> t2.timeit(number=1000*1000*100)
>> >> > 16.431484448442404
>> >> >  >>> t2.timeit(number=1000*1000*100)
>> >> > 16.100137587319068
>> >> >  >>> t.timeit(number=1000*1000*100)
>> >> > 18.39941975865645
>> >> >  >>> t.timeit(number=1000*1000*100)
>> >> > 18.368376986460589
>> >> >  >>>
>> >> >
>> >> > 谁能解释一下?
>> >> >
>> >> > --
>> >> > Linker M Lin
>> >> > linkerlin88在gmail.com linkerlin88在gmail.com>
>> >> > linker.m.lin在gmail.com linker.m.lin在gmail.com>
>> >> >   ※※※※※※※※※
>> >> >   ※※我思故我在※※
>> >> >   ※※※※※※※※※
>> >> >
>> >> >
>> >> > ------------------------------------------------------------------------
>> >> >
>> >> > _______________________________________________
>> >> > python-chinese
>> >> > Post: send python-chinese在lists.python.cn
>> >> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
>> >> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>> >> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >>
>> >>
>> >> --
>> >> Best regards!
>> >>
>> >> Kasicass/sYcini - Coder
>> >> http://www.sycini.com
>> >>
>> >> _______________________________________________
>> >> python-chinese
>> >> Post: send python-chinese在lists.python.cn
>> >> Subscribe: send subscribe to python-chinese-request在lists.python.cn
>> >> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>> >> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>> >
>> >
>> >
>> >
>> >--
>> >Linker M Lin
>> >linkerlin88在gmail.com
>> >linker.m.lin在gmail.com
>> >  ※※※※※※※※※
>> >  ※※我思故我在※※
>> >  ※※※※※※※※※
>> >_______________________________________________
>> >python-chinese
>> >Post: send python-chinese在lists.python.cn
>> >Subscribe: send subscribe to python-chinese-request在lists.python.cn
>> >Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>> >Detail Info: http://python.cn/mailman/listinfo/python-chinese
>>
>>
>>
>> _______________________________________________
>> python-chinese
>> Post: send python-chinese在lists.python.cn
>> Subscribe: send subscribe to python-chinese-request在lists.python.cn
>> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>_______________________________________________
>python-chinese
>Post: send python-chinese在lists.python.cn
>Subscribe: send subscribe to python-chinese-request在lists.python.cn
>Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>Detail Info: http://python.cn/mailman/listinfo/python-chinese




[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号