From: "Carlo E. Prelz" Date: 2012-12-24T05:39:42+09:00 Subject: Re: simple division: -9 / 5 = -2 what? Subject: Re: simple division: -9 / 5 = -2 what? Date: Mon 24 Dec 12 03:32:57AM +0900 Quoting Matma Rex (matma.rex@gmail.com): > On Sun, 23 Dec 2012 19:24:00 +0100, Derrick B. wrote: > > >But I want a "correct" answer, which is not -2. Hence: > > Why? -9 / 5 = -2 with a remainder of 1, because -2 * 5 + 1 = -9. Yes, but... Why is it that this C code: #include "stdio.h" void main(void) { int i1=-9,i2=5; printf("%d/%d=%d\n",i1,i2,i1/i2); } produces this output: -9/5=-1 ? I don't know which one is right, but I thought both C and Ruby were doing integer maths in the same way... Carlo -- * Se la Strada e la sua Virtu' non fossero state messe da parte, * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)