[Python-bugs-list] [ python-Bugs-444510 ] int() should guarantee truncation

noreply@sourceforge.net noreply@sourceforge.net
Thu, 26 Jul 2001 13:05:06 -0700


Bugs item #444510, was opened at 2001-07-25 09:03
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=444510&group_id=5470

Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Tim Peters (tim_one)
Summary: int() should guarantee truncation

Initial Comment:
The int() function currently warns that it cannot
guarantee truncation because C doesn't guarantee it. 
However, all known (to us) C implementations *do*
truncate, and the C99 standard requires it, so we might
as well change the code to promise truncation and
tighten the docs.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-07-26 13:05

Message:
Logged In: YES 
user_id=31435

Truncation now guaranteed.

Doc/lib/libfuncs.tex; new revision: 1.81
Lib/test/test_b1.py; new revision: 1.36
Objects/floatobject.c; new revision: 2.83

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-07-26 12:51

Message:
Logged In: YES 
user_id=31435

Assigned to me.

BTW, note that I wasn't guessing about the behavior of "all 
known Python platforms":  Python's test_b1.py has been 
checking all along that int(float) truncates, so if there 
were a platform where that didn't happen, we would have 
heard about it.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=444510&group_id=5470