[Python-Dev] trunc() (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jan 28 07:10:13 CET 2008
- Previous message: [Python-Dev] trunc()
- Next message: [Python-Dev] trunc()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jan 25, 2008 11:21 PM, Raymond Hettinger <python at rcn.com> wrote:
... int() for making ints from the non-fractional portion of a float.
To me, the concept of the "integer part of a float" isn't all that well defined. It's really a property of a particular representation rather than the number itself. You think of it as a string of digits and chop off the part after the point, then turn what's left back into a number.
If negative floats were represented in two's complement, for example, then chopping off the digits after the point would give a result more like floor than trunc.
-- Greg
- Previous message: [Python-Dev] trunc()
- Next message: [Python-Dev] trunc()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]