Re: [Python-Dev] PEP 238 - The // operator should truncate instead of floor

2007-08-29 Thread Martin v. Löwis
> This non-quotient division leads to some odd results, e.g. Python seems > to think -3/2+3/2 = -1. This is clearly, and correct me if I'm mistaken > - wrong. Lino already pointed you to the relevant FAQ entry, but since you explicitly asked for it: you are mistaken, the result is right. It wou

Re: [Python-Dev] PEP 238 - The // operator should truncate instead of floor

2007-08-29 Thread Fredrik Johansson
On 8/29/07, dany <[EMAIL PROTECTED]> wrote: > Looking deeper in the python PEPs, I saw that division on integers is > defined as: idiv(a, b) = floor(fdiv(a, b)). > This non-quotient division leads to some odd results, e.g. Python seems > to think -3/2+3/2 = -1. This is clearly, and correct me if I'

Re: [Python-Dev] PEP 238 - The // operator should truncate instead of floor

2007-08-29 Thread Lino Mastrodomenico
2007/8/29, dany <[EMAIL PROTECTED]>: > For some reason, the integer division behaves unexpectedly for negative > integers. > > Looking deeper in the python PEPs, I saw that division on integers is > defined as: idiv(a, b) = floor(fdiv(a, b)). > This non-quotient division leads to some odd results,

[Python-Dev] PEP 238 - The // operator should truncate instead of floor

2007-08-29 Thread dany
Hi all First, some background. I've recently tried to port a certain library that manipulates dates from C. Some of the core functions contain heavy integer math (very long formulae), and after implementing them I tested them to see the give the desired results. I got very odd results, which su