From: Matma Rex Date: 2012-12-24T06:07:04+09:00 Subject: Re: simple division: -9 / 5 = -2 what? On Sun, 23 Dec 2012 21:39:42 +0100, Carlo E. Prelz wrote: > > I don't know which one is right, but I thought both C and Ruby were > doing integer maths in the same way... Both are right. You can perform the division is two ways: one that gives negative remainders and one that doesn't. The precise behavior of Ruby implementation is documented here: http://www.ruby-doc.org/core-1.9.3/Numeric.html#method-i-divmod I suggest just not doing integer division with negative numbers, less trouble. -- Matma Rex