Help me please : Rounding-down numbers

Joseph joseph.redimerio at baesystems.com
Sun Mar 30 23:58:56 EST 2003


"Tim Peters" <tim_one at email.msn.com> wrote in message news:<mailman.1048735482.29822.python-list at python.org>...
> [Joseph]
> > I have a floating number which I need to "round-down" to the nearest
> > whole number. I am doing this by type-casting it as an "int". Would
> > this work all the time ? Or is there any instances when this will
> > "round-up" ?
> 
> The question is clear enough.  What I'm unclear about is what you found
> unclear in the docs for the int() function:
> 


    I don't find anything "unclear" about the docs because I simply
haven't had a chance to look at them :o) ... thanks for looking it up
for me though. Hey, it's April fool's day soon ... haha.


>     http://www.python.org/doc/current/lib/built-in-funcs.html
> 
> and in particular what about
> 
>     Conversion of floating point numbers to integers truncates
>     (towards zero)
> 
> did you read as leaving the question open?

Cheers,
Joseph 74




More information about the Python-list mailing list