This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author facundobatista
Recipients facundobatista, must21
Date 2008-02-18.12:25:04
SpamBayes Score 0.01185624
Marked as misclassified No
Message-id <1203337505.25.0.356653576709.issue2140@psf.upfronthosting.co.za>
In-reply-to
Content
In short: 

>>> long(100 * 146.95)
14694L

This is NOT a bug, but a behaviour of binary floating point:

>>> 146.95
146.94999999999999

In binary you can not express this number exactly.

>>> 146.95 * 100
14694.999999999998

When you long() that, you truncate the number, so it goes to 14694.

Please address further discussion through python-list.

Thanks!
History
Date User Action Args
2008-02-18 12:25:05facundobatistasetspambayes_score: 0.0118562 -> 0.01185624
recipients: + facundobatista, must21
2008-02-18 12:25:05facundobatistasetspambayes_score: 0.0118562 -> 0.0118562
messageid: <1203337505.25.0.356653576709.issue2140@psf.upfronthosting.co.za>
2008-02-18 12:25:04facundobatistalinkissue2140 messages
2008-02-18 12:25:04facundobatistacreate