[Python-ideas] What math.floor(inf) should return? Was: Make `float('inf') //1 == float('inf')`

Mark Dickinson dickinsm at gmail.com
Fri Sep 19 14:44:20 CEST 2014


On Fri, Sep 19, 2014 at 3:16 AM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

> The standards are influenced by the limitation inherent in many languages
> where ints have finite range and cannot represent floor() of many finite
> floating point values.  Python does not have this limitation.  (Granted -
> PEP 3141 could do a better job explaining why floor, ceil, round, //, etc.
> should return Integer rather than Real.)
>

Indeed.  FWIW, I think it was a mistake to change the return type of
math.floor and math.ceil in Python 3.  There's no longer any way to spell
the simple, fast, float->float floor operation.  It would be nice to have
those basic floating-point math operations accessible again.

-- 
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140919/b6a3c6ad/attachment.html>


More information about the Python-ideas mailing list