Why does int(5.0) returns 0

Chad Netzer cnetzer at mail.arc.nasa.gov
Mon Jan 27 20:39:58 EST 2003


On Monday 27 January 2003 14:50, Mike Meyer wrote:
> spatel <spatel at cinci.rr.com> writes:
> > glibc 2.3.1-r2 with pentium4 and -O3 optimization created this
> > mess. When I recompile glibc without optimization, it fix this
> > problem. Thank you very much for all of your help.
>
> The FreeBSD community generally considers gcc optimization levels
> 2 or greater to be broken. You might try it with just -O. That works
> fine here. Actually, I use "-O -pipe".

Also, the version of gcc matters.  I feel a lot more comfortable using 
-O3 w/ gcc3.2 (just because so far I haven't been burned by it; I was 
burned w/ gcc 2.95.[1.2] a couple times (once with optimization on, and 
once, bizarrely, when turning it off), just when compiling Python 
itself.)

In any case, "-Os -pipe" is often even (slightly) faster on modern 
processors, due to the importance of cache memory.

-- 
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)





More information about the Python-list mailing list