aproximate a number

Will McGugan news at NOwillmcguganSPAM.com
Sun Aug 28 23:19:56 CEST 2005


billiejoex wrote:
> Hi all. I'd need to aproximate a given float number into the next (int) 
> bigger one. Because of my bad english I try to explain it with some example:
> 
> 5.7 --> 6
> 52.987 --> 53
> 3.34 --> 4
> 2.1 --> 3
> 

Have a look at math.ceil

 >>> import math
 >>> math.ceil(5.7)
6.0


Will McGugan
-- 
http://www.willmcgugan.com
"".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in 
"jvyy*jvyyzpthtna^pbz")



More information about the Python-list mailing list