Arbitrary precision integer arithmetic: ceiling?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Mar 9 03:38:18 CET 2008


On Sun, 09 Mar 2008 02:16:39 +0000, Steven D'Aprano wrote:

> On Sat, 08 Mar 2008 15:26:35 -0800, Paul Rubin wrote:
> 
>> Alasdair <amca01 at gmail.com> writes:
>>> What is the best way of finding a ceiling of a quotient of arbitrary
>>> sized integers?
>> 
>> ceiling(a/b) = (a+b-1)//b
> 
> 
> Unfortunately that doesn't work reliably.

But of course you didn't intend it to work with floats, did you?

Sigh.

I'm just glad I didn't rant about people who think that floats are just 
like reals when they're not.


-- 
Steven



More information about the Python-list mailing list