[issue2653] string to float to int

2008-04-18 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: >>> int('%.0f' % (float('1.005')*1000)) 1005 >>> int(Decimal('1.005')*1000) 1005 -- nosy: +rhettinger __ Tracker <[EMAIL PROTECTED]> _

[issue2653] string to float to int

2008-04-18 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Yes, and >>> 1.005 * 1000 1004.9 Please read http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate To perform exact base-10 calculation, you may use the Decimal module. Or use round(

[issue2653] string to float to int

2008-04-18 Thread wr
New submission from wr <[EMAIL PROTECTED]>: IDLE 1.2.1 >>> print int(float('1.005')*1000) 1004 -- components: None messages: 65602 nosy: wr severity: normal status: open title: string to float to int type: behavior versions: Python 2.5 __ Tracker <[