Bug #3289: Division of negative numbers
http://redmine.ruby-lang.org/issues/show/3289

Author: Patrick Thomson
Status: Open, Priority: Normal
Category: core
ruby -v: 1.9.1

The documentation for Numeric (http://www.ruby-doc.org/core/classes/Numeric.html#M000179) states that integer divmod() (and, by extension, /) rounds the quotient towards negative infinity. Python and Tcl behave similarly, while C, Java, bc, and gdb round the quotient towards zero, as is taught in standard arithmetic courses.  

Is this a quirk of MRI's implementation, or is it desired Ruby behavior? If so, why?
It's counterintuitive that (-x/y) กโ -(x/y), and even moreso when (-x/y) = -(x/y) if x or y is a non-integer.


----------------------------------------
http://redmine.ruby-lang.org