Rounding Question
Mikael Olofsson
mikael at isy.liu.se
Thu Feb 22 02:23:19 EST 2001
On 21-Feb-01 Remco Gerlich wrote:
> I'd go for
> rounded = number-(number%10)+10
> now.
I'm sorry, but this also behaves badly. It rounds 10 up to 20. To get
Jacob's desired functionality, you could modify your idea to
rounded = number-((number-1)%10)+9
still assuming only integer input.
/Mikael
-----------------------------------------------------------------------
E-Mail: Mikael Olofsson <mikael at isy.liu.se>
WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone: +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date: 22-Feb-01
Time: 08:18:49
/"\
\ / ASCII Ribbon Campaign
X Against HTML Mail
/ \
This message was sent by XF-Mail.
-----------------------------------------------------------------------
More information about the Python-list
mailing list