Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Float to int conversions (was: int(float(sys.maxint)) buglet)

Reply
Thread Tools

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

 
 
Nick Coghlan
Guest
Posts: n/a
 
      12-06-2004
<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.p...34&view=markup

Cheers,
Nick.

--
Nick Coghlan | http://www.velocityreviews.com/forums/(E-Mail Removed) | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
float to string to float, with first float == second float Carsten Fuchs C++ 45 10-08-2009 09:47 AM
conversions from float to int? chandanlinster C Programming 4 07-23-2006 11:26 AM
Float to int conversion by using two int variables for representation of the float variable k3n3dy C++ 15 04-20-2006 06:53 PM
Re: float->byte->float is same with original float image. why float->ubyte->float is different??? bd C Programming 0 07-07-2003 12:09 AM
dirty stuff: f(int,int) cast to f(struct{int,int}) Schnoffos C Programming 2 06-27-2003 03:13 AM



Advertisments