Re: aproximate a number

2005-08-30 Thread billiejoex
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

Re: aproximate a number

2005-08-29 Thread Mikael Olofsson
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

Re: aproximate a number

2005-08-29 Thread Peter Hansen
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

Re: aproximate a number

2005-08-29 Thread Thomas Bartkus
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

Re: aproximate a number

2005-08-29 Thread Devan L
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

Re: aproximate a number

2005-08-29 Thread Grant Edwards
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

Re: aproximate a number

2005-08-29 Thread Devan L
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

Re: aproximate a number

2005-08-29 Thread Grant Edwards
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

aproximate a number

2005-08-28 Thread billiejoex
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

Re: aproximate a number

2005-08-28 Thread rafi
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

Re: aproximate a number

2005-08-28 Thread Will McGugan
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 --

Re: aproximate a number

2005-08-28 Thread billiejoex
Thank you. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: aproximate a number

2005-08-28 Thread Michael Sparks
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