Bugs item #1095789, was opened at 2005-01-04 09:53
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1095789&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: JastheAce (jayse24)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug In Python

Initial Comment:
We are trying to convert a string value of "4.02" into a 
interger value multipled by 100.

Eg: 

Int(float("4.02")*100)

I think this should return 402 but returns 401

If i replace "4.02" with "4.04, it should return 404 and it 
does

Every other number from 4.02 returns an incorrect value.

4.02
4.06
4.10
4.14

etc etc

Can someone help this is driving me mad

Cheers JastheAce

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2005-01-04 14:48

Message:
Logged In: YES 
user_id=80475

This is just one of the many joys of floating point
arithmetic.  See Appendix B in the tutorial for a hint about
what is going on.

To get the results you want, run round(x,0) before applying
int().

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1095789&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to