round down to nearest number
Ian Kelly
ian.g.kelly at gmail.com
Thu Feb 9 21:00:37 EST 2012
More information about the Python-list mailing list
Thu Feb 9 21:00:37 EST 2012
- Previous message (by thread): round down to nearest number
- Next message (by thread): round down to nearest number
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Feb 9, 2012 at 6:43 PM, Chris Rebert <clp2 at rebertia.com> wrote: > On Thu, Feb 9, 2012 at 5:23 PM, noydb <jenn.duerr at gmail.com> wrote: >> hmmm, okay. >> >> So how would you round UP always? Say the number is 3219, so you want >> 3300 returned. > > http://stackoverflow.com/questions/17944/how-to-round-up-the-result-of-integer-division/96921 > > Thus: (3219 + 99) // 100 > > Slight tangent: Beware negative numbers when using // or %. There's no problem with negative numbers here, as long as you actually want to round *up* or *down*, as opposed to away from zero or toward zero.
- Previous message (by thread): round down to nearest number
- Next message (by thread): round down to nearest number
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list