[Python-Dev] trunc() (original) (raw)

Raymond Hettinger python at rcn.com
Fri Jan 25 20:50:56 CET 2008


.some pocket calculators have an INT function, defined as floor(x) when x is positive and ceil(x) when x is negative

That's the mathematical definition. The way they explain it is dirt simple: return the integer portion of a number.

Some of the calculators that have int() also have frac() which has the obvious interpretation.

Raymond



More information about the Python-Dev mailing list