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

Discussion in 'Python' started by Nick Coghlan, Dec 6, 2004.

  1. Nick Coghlan

    Nick Coghlan Guest

    <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.

    --
    Nick Coghlan | | Brisbane, Australia
    ---------------------------------------------------------------
    http://boredomandlaziness.skystorm.net
    Nick Coghlan, Dec 6, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bd
    Replies:
    0
    Views:
    605
  2. Grant Edwards
    Replies:
    3
    Views:
    578
    Grant Edwards
    Aug 11, 2004
  3. Bengt Richter

    int(float(sys.maxint)) buglet ?

    Bengt Richter, Nov 24, 2004, in forum: Python
    Replies:
    0
    Views:
    349
    Bengt Richter
    Nov 24, 2004
  4. Bengt Richter
    Replies:
    6
    Views:
    338
    Bengt Richter
    Dec 9, 2004
  5. Dave Huang
    Replies:
    1
    Views:
    366
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Mar 27, 2005
Loading...

Share This Page