---------- Forwarded message ---------- From: Ian Cordasco email@example.com Date: Wed, Sep 17, 2014 at 4:51 PM Subject: Re: [Python-ideas] Make `float('inf') //1 == float('inf')` To: Ram Rachum firstname.lastname@example.org Cc: "email@example.com" firstname.lastname@example.org
On Wed, Sep 17, 2014 at 11:42 AM, Ram Rachum email@example.com wrote:
Please see this discussion on python-list:
Currently `float('inf') //1` is equal to NaN. I think that this is really weird. If I understand correctly it's to maintain the invariant `div*y + mod == x`. The question is, do we really care more about maintaining this invariant rather than providing a mathematically reasonable value for floor division?
Actually there are 2 things here:
1. Mathematically speaking, infinity is a real number and modulo arithmetic is algebraically not defined for it. So the "mathematically reasonable value" is NaN. Is it intuitive for someone who hasn't studied abstract algebra? Probably not. Is it functional for the scientific python community? Almost certainly although I won't pretend to speak on their behalf
2. Changing this behaviour is not something I think we should do in a minor version of 3.4 or in 3.5 (or really 3.x).