Help me please : Rounding-down numbers

Erik Max Francis max at alcyone.com
Wed Mar 26 21:19:14 EST 2003


Skip Montanaro wrote:

> There is also the floor() function in the math module:
> 
>     >>> math.floor(4.71)
>     4.0
>     >>> int(4.71)
>     4

Note that math.floor and int don't have quite the same behavior
(glossing over the obvious difference that the former returns a float)
for the case of negative numbers.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Even paranoids have real enemies.
\__/ Delmore Schwartz
    Official Omega page / http://www.alcyone.com/max/projects/omega/
 The official distribution page for the popular Roguelike, Omega.




More information about the Python-list mailing list