Message227151
Perhaps it's worth mentioning that several people on Python-ideas took the
opposite view: math.floor() should return a float.
PEP-3141 does not mention Infinities and NaNs:
"The Real ABC indicates that the value is on the real line, and supports
the operations of the float builtin. Real numbers are totally ordered
except for NaNs (which this PEP basically ignores)."
Floats, however, are on the extended real number line, so we have a problem. :)
Other languages
===============
The PEP says that inspiration came from Scheme and Haskell.
However, Scheme returns floats:
-------------------------------
https://mail.python.org/pipermail/python-ideas/2014-September/029432.html
Haskell seems to return the highest representable integer:
----------------------------------------------------------
Prelude> floor (1/0)
179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216
However, Haskell float support looks sketchy:
---------------------------------------------
Prelude> floor (0/0)
-269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824
Prelude> let x = 1 / 0
Prelude> x
Infinity
Prelude> x / 0
Infinity
Considering the last two examples, I think Haskell should not provide any
guidance here. ;) |
|
Date |
User |
Action |
Args |
2014-09-20 10:49:51 | skrah | set | recipients:
+ skrah, rhettinger, belopolsky, pitrou, casevh |
2014-09-20 10:49:51 | skrah | link | issue22444 messages |
2014-09-20 10:49:50 | skrah | create | |
|