From: brabuhr@... Date: 2009-08-12T10:21:57+09:00 Subject: [ruby-core:24872] Re: [Bug #1925] Division of negative numbers On Tue, Aug 11, 2009 at 7:17 AM, Roswitha Rissner wrote: > Bug #1925: Division of negative numbers > http://redmine.ruby-lang.org/issues/show/1925 > > Author: Roswitha Rissner > Status: Open, Priority: Normal > ruby -v: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] > > The divison ot two numbers a and b isn't complient to the specification. > In case a*b < 0, the result of a/b the same as a.divmod(b)[0]. > Example: 13/-4 => -4; 13.divmod(-4) = [-4,-3]. > According to http://www.ruby-doc.org/core/ the quotient of 13 and -4 should be -3. More specific link: http://www.ruby-doc.org/core/classes/Numeric.html#M000179 The documentation is incorrect and should read -4, yes? a | b | a.divmod(b) | a/b | a.modulo(b) | a.remainder(b) 13 | -4 | -4, -3 | -3 | -3 | 1