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 must21
Recipients facundobatista, must21
Date 2008-02-18.12:55:36
SpamBayes Score 0.00015676179
Marked as misclassified No
Message-id <08FB341A-E1A5-4EDA-90B2-215C4F192F22@mstoll.de>
In-reply-to <1203337505.25.0.356653576709.issue2140@psf.upfronthosting.co.za>
Content
thank you for fast reply

I see the point and do not want to argue about that (rounding is fine  
for me). I just think this behaviour makes the long() function pretty  
much useless.

Regards, Markus
Am 18.02.2008 um 13:25 schrieb Facundo Batista:

>
> Facundo Batista added the comment:
>
> 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!
>
> ----------
> nosy: +facundobatista
> resolution:  -> invalid
> status: open -> closed
>
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue2140>
> __________________________________
History
Date User Action Args
2008-02-18 12:55:37must21setspambayes_score: 0.000156762 -> 0.00015676179
recipients: + must21, facundobatista
2008-02-18 12:55:36must21linkissue2140 messages
2008-02-18 12:55:36must21create