Integer math question

Elaine Jackson elainejackson7355 at home.com
Sun Jan 4 01:45:46 EST 2004


C rounds toward the nearest integer and Python rounds down. The behavior is
consistent in each case.

"Frank" <mersmann at szut.uni-bremen.de> wrote in message
news:3987e01c.0401030832.114c6f2a at posting.google.com...
| Hi,
|
| can anybody help with the following problem?
|
| In C++
|
| i = 5 / 10 and
| i = -5 / 10 both have the same result 0.
|
| In python
|
| i = 5 / 10 gives me 0 as expected, but
| i = -5 / 10 gives -1 as result.
|
| Is this a feature or a bug? I remember Delphi gave me the same result as
| C++.
|
| TIA,
| Frank





More information about the Python-list mailing list