On Mar 8, 8:48 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Sat, 08 Mar 2008 17:09:11 -0800, Mark Dickinson wrote:
> > I prefer:
>
> > ceiling(a/b) = -(-a)//b
>
> Unfortunately it doesn't give the right answer.
>
> >>> a, b = 101.0, 10.0
> >>> -(-a)//b  # should be 11.0
> 10.0
> >>> a, b = -101.0, 10.0
> >>> -(-a)//b  # should be -10.0
>
> -11.0
>
> Looks like you've confused ceiling() and floor().

Whoops, you're right.  No, I didn't confuse ceiling and floor;
I misplaced the parentheses.  I meant to type:

ceiling(a/b) = -(-a//b)

Mark
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to