[Python-bugs-list] [ python-Bugs-751894 ] int()
SourceForge.net
noreply@sourceforge.net
Tue, 10 Jun 2003 20:12:41 -0700
Bugs item #751894, was opened at 2003-06-10 07:48
Message generated for change (Comment added) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=751894&group_id=5470
Category: None
Group: Python 2.2.3
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Hartmut Fröls (froels)
Assigned to: Nobody/Anonymous (nobody)
Summary: int()
Initial Comment:
Seems to me like an error in int():
Python 2.2.3 (#1, Jun 5 2003, 21:12:33)
ÄGCC 3.2.3Ü on aix4
Type "help", "copyright", "credits" or "license" for
more information.
>>> print int((4.3 % 1)*10)
2
>>> print 4.3 % 1
0.3
>>> print 4.3 % 1 * 10
3.0
>>> print int(4.3 % 1 * 10)
2
Is this a bug ???
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-06-10 22:12
Message:
Logged In: YES
user_id=80475
Ah, the joys of floating point.
Closing the bug as invalid.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2003-06-10 09:14
Message:
Logged In: YES
user_id=31435
Try displaying the penultimate result to full precision. On my
box I get this:
>>> 4.3 % 1 * 10
2.9999999999999982
>>>
int() of that is 2. What do you get? And have you read the
Python Tutorial appendix on floating-point issues?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=751894&group_id=5470