I wanted the round up the number (5.0 = 5.0, not 6.0.). The ceil funciotn is
the right one for me.
Thanks to all.
Grant Edwards wrote:
On 2005-08-30, Devan L [EMAIL PROTECTED] wrote:
RoundToInt(2.0) will give you 3.
That's what the OP said he wanted. The next bigger integer
after 2.0
Michael Sparks wrote:
def approx(x):
return int(x+1.0)
I doubt this is what the OP is looking for.
approx(3.2)
4
approx(3.0)
4
Others have pointed to math.ceil, which is most likely what the OP wants.
/Mikael Olofsson
Universitetslektor (Senior Lecturer [BrE], Associate Professor
Mikael Olofsson wrote:
Michael Sparks wrote:
def approx(x):
return int(x+1.0)
I doubt this is what the OP is looking for.
...
Others have pointed to math.ceil, which is most likely what the OP wants.
I agree that's likely but, as Michael pointed out in the text you
removed, his
On Sun, 28 Aug 2005 23:11:09 +0200, 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
The standard way to do this is thus:
def
Thomas Bartkus wrote:
On Sun, 28 Aug 2005 23:11:09 +0200, 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
The standard
On 2005-08-30, Devan L [EMAIL PROTECTED] 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
The standard way to do this is thus:
def
Grant Edwards wrote:
On 2005-08-30, Devan L [EMAIL PROTECTED] wrote:
RoundToInt(2.0) will give you 3.
That's what the OP said he wanted. The next bigger integer
after 2.0 is 3.
--
Grant Edwards grante Yow! I'd like TRAINED
On 2005-08-30, Devan L [EMAIL PROTECTED] wrote:
Grant Edwards wrote:
On 2005-08-30, Devan L [EMAIL PROTECTED] wrote:
RoundToInt(2.0) will give you 3.
That's what the OP said he wanted. The next bigger integer
after 2.0 is 3.
It's not really clear whether he wanted it to round up or to
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
Regards
--
http://mail.python.org/mailman/listinfo/python-list
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
Regards
math.ceil returns what you need but as a float, then create an
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
--
Thank you. :-)
--
http://mail.python.org/mailman/listinfo/python-list
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
What about 2.0? By your spec that should be rounded to 3 - is that what you
13 matches
Mail list logo