Float to int conversions (was: int(float(sys.maxint)) buglet)

N

Nick Coghlan

<Sorry for the disconnected reply -I've been having news server issues, and just
switched to the mailing list instead>

A quick check of the source code reveals that this behaviour is deliberate.
There is apparently an issue with the corner case breaking badly (potentially
raising an exception) on some platforms. So, Python plays it safe and converts
the two boundary cases to Python longs instead of Python ints.

See the code for the gory details (the relevant function is 'float_int'):
http://cvs.sourceforge.net/viewcvs....c/Objects/floatobject.c?rev=2.134&view=markup

Cheers,
Nick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top