weird float() behavior

Michael Hudson mwh at python.net
Mon Mar 31 08:22:57 EST 2003


pball at umich.edu (pball) writes:

[snip screwiness]

> ok, it seems pretty likely that it's the gentoo python 2.2.2 with the
> bleeding-edge gcc 3.2.2. I found that float was triggering it, but
> actually, int() is just very sick:
> 
> 
> [pball at wylbur]% python                                                
>  ~
> Python 2.2.2 (#1, Mar 29 2003, 23:20:21)
> [GCC 3.2.2 20030322 (Gentoo Linux 1.4 3.2.2-r2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> s = '3.1415' 
> >>> int( float(s) ) -610
> >>> int( 3.1416 ) 0
> >>> int( 3.1415 ) -610
> >>> int( 3.1417 ) 0
> >>> int( 3.1419 )
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> OverflowError: float too large to convert
> >>>
> 
> Ok, that's enough.  Has anyone else seen this?  Any ideas how I broke
> it so completely? Is there more info I can post to better identify it?
> Is there a regression test we could add to the post-compile process to
> flag this?

There is an extensive test suite already; I'd be amazed if a Python so
obviously broken passed it.

Cheers,
M.

-- 
  In that case I suggest that to get the correct image you look at
  the screen from inside the monitor whilst standing on your head.  
               -- James Bonfield, http://www.ioccc.org/2000/rince.hint




More information about the Python-list mailing list