[Python-Dev] Rounding float to int directly ... (original) (raw)
Nick Maclaren nmm1 at cus.cam.ac.uk
Thu Aug 3 10:35:23 CEST 2006
- Previous message: [Python-Dev] struct module and coercing floats to integers
- Next message: [Python-Dev] Rounding float to int directly ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
James Y Knight <foom at fuhm.net> wrote:
I'd be happy to see floats lose their int method entirely, replaced by an explicit truncate function.
Come back Algol - all is forgiven :-) Yes, indeed. I have favoured that view for 35 years - anything that can lose information quietly should be explicit.
tanzer at swing.co.at (Christian Tanzer) wrote:
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> What's the feeling about this? If, e.g. int() > were changed in Py3k to round instead of truncate, > would it cause anyone substantial pain? Gratuitous breakage! I shudder at the thought of checking hundreds of int-calls to see if they'd still be correct under such a change.
My experience of doing that when compilers sometimes did one and sometimes the other is that such breakages are rarer than the conversions to integer that are broken with both rules! And both are rarer than the code that works with either rule.
However, a 5% breakage rate is still enough to be of concern.
Regards, Nick Maclaren, University of Cambridge Computing Service, New Museums Site, Pembroke Street, Cambridge CB2 3QH, England. Email: nmm1 at cam.ac.uk Tel.: +44 1223 334761 Fax: +44 1223 334679
- Previous message: [Python-Dev] struct module and coercing floats to integers
- Next message: [Python-Dev] Rounding float to int directly ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]