Message227161
> Perhaps it's worth mentioning that several people on Python-ideas
> took the opposite view: math.floor() should return a float.
I sympathize with the idea that math module functions should return floats. I find it unfortunate that math.floor delegates to the __floor__ dunder on non-floats instead of doing math.floor(x.__float__()). It would be more natural to have a floor builtin that *always* delegates to __floor__ and keep math a pure float library.
Note that math module provides the means to compute C-style floor:
>>> x = float('inf')
>>> math.modf(x)[1]
inf
>>> x = -3.4
>>> math.modf(x)[1]
-3.0
Maybe we should add floorf, ceilf, etc. as well. This, however, is a different issue from the one at hand here. |
|
Date |
User |
Action |
Args |
2014-09-20 16:38:08 | belopolsky | set | recipients:
+ belopolsky, rhettinger, pitrou, casevh, skrah |
2014-09-20 16:38:08 | belopolsky | set | messageid: <1411231088.07.0.732795088443.issue22444@psf.upfronthosting.co.za> |
2014-09-20 16:38:08 | belopolsky | link | issue22444 messages |
2014-09-20 16:38:07 | belopolsky | create | |
|