[Python-Dev] Rounding float to int directly (Re: struct module and coercing floats to integers) (original) (raw)
Simon Burton simon at arrowtheory.com
Thu Aug 3 03:39:26 CEST 2006
- Previous message: [Python-Dev] TRUNK is UNFROZEN
- Next message: [Python-Dev] struct module and coercing floats to integers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 2 Aug 2006 07:21:02 -0400 "Chermside, Michael" <mchermside at ingdirect.com> wrote:
You wrote: > (ie. I am wondering if truncating the float representation > of an int always gives back the original int). Yes it does, because all integers that can be expressed as floats can be expressed EXACTLY as floats.
Yes, OK this makes sense.
My point is that, regardless of this answer, as a python user I should not be worried by such details. At least: the doc string for round() should be expanded to mention the int(round(x)) use case.
Simon.
-- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 2 6249 6940 http://arrowtheory.com
- Previous message: [Python-Dev] TRUNK is UNFROZEN
- Next message: [Python-Dev] struct module and coercing floats to integers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]