aproximate a number

Grant Edwards grante at visi.com
Tue Aug 30 00:48:03 EDT 2005


On 2005-08-30, Devan L <devlai at gmail.com> wrote:
> Grant Edwards wrote:
>> On 2005-08-30, Devan L <devlai at gmail.com> 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 go to the
> next biggest integer because he says he has bad english. I can't think
> of a particular use of returning the next bigger integer.

You're probably right.  I suspect what he really wants is

i = int(math.ceil(x))

-- 
Grant Edwards                   grante             Yow!  Is it FUN to be
                                  at               a MIDGET?
                               visi.com            



More information about the Python-list mailing list