Pardon my ignorance, data conversion

Tim Peters tim_one at email.msn.com
Tue Jan 18 23:28:36 EST 2000


[Michael P. Reilly sez "floor does funny things to negative
 numbers", Ivan defends its honor]

> I disagree.  They're not funny, only unexpected if you've
> been working with C or some other language that doesn't
> floor() or ceil() the same way Python does.  It's merely
> a different perspective on what's right.

The floor and ceiling functions predate computers, and there's no
disagreement about their definitions (coincidence or plot?  you be the judge
<wink>).  Python's floor & ceil *are* C's -- like most everything else in
Python's math module, they're tissue-thin wrappers around the platform C
library functions of the same names.  Modulo floating point endcases
(infinities & NaNs & such), their behavior is the same across platforms.

moving-left-on-the-number-line-is-a-matter-of-perspective-
    only-in-the-presence-of-drugs-ly y'rs  - tim






More information about the Python-list mailing list