converting float to int issue
Alex
delete.this.part.alex.news at attbi.com
Mon May 5 14:47:06 EDT 2003
Alex wrote:
> Irmen de Jong wrote:
>
>> Alex wrote:
>>> Converting a float to an int produces strange results. Is this just a
>>> bug
>>> or am I missing something? I tried to search the bug database, but was
>>> unsucsessful.
>>>
>>> Converting a float to a long works as I would expect.
>>>
>>> Python 2.2.2 (#1, Apr 16 2003, 22:00:16)
>>> [GCC 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207)] on linux2
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>>>>int(1.0)
>>>
>>> 0
>>>
>>>>>>int(3.0)
>>>
>>> 0
>>>
>>>>>>int(3.14)
>>>
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in ?
>>> OverflowError: float too large to convert
>>
>> Something weird is going on with your specific Python and/or system.
>> I verified this and it works fine on Python 2.2.2.
>>
>> Is your GCC broken? Is your libc broken? Did you compile with
>> esoteric optimization options? One of these is what I'm betting on.
>>
>> --Irmen.
>>
>>
>> PS did you try to run Python's test set? "make test"
>
> No esoteric build options. A 'vanilla' gentoo box, if there is such a
> thing. Everything has been working fine for months, so no obvious
> problems with gcc or libc.
>
> I'll try "make test", as you suggest, and then try building a different
> version of libc. I guess I should troll the gentoo newsgroups too.
>
> Thanks,
> Alex
Found the problem and resolution:
http://forums.gentoo.org/viewtopic.php?t=27211
Thanks everybody.
Alex
More information about the Python-list
mailing list