Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76325

Re: Odd floor-division corner case

References <lsirpk$bq2$2@ger.gmane.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2014-08-14 11:46 -0600
Subject Re: Odd floor-division corner case
Newsgroups comp.lang.python
Message-ID <mailman.13006.1408038440.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Aug 14, 2014 at 11:31 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> From http://bugs.python.org/issue22198
>
>>>> -0.5 // float('inf')
> -1.0

Looks like the result is the same for any negative dividend.

> What should it be?

It's surprising, but I think it's correct. A negative infinitesimal
would be less than 0, so its floor should be -1, not 0.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Odd floor-division corner case Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 11:46 -0600

csiph-web