From: Alexey Muranov Date: 2011-10-30T07:39:18+09:00 Subject: [ruby-core:40517] [ruby-trunk - Feature #3289] Division of negative numbers Issue #3289 has been updated by Alexey Muranov. I think that both operations have right to exist. Maybe one of them should be denoted '/' and the other 'div'. For example: '/' rounds towards 0 and thus is symmetric with respect to exchanging x and -x, and 'div' returns the quotient and remainder in the "integral" sense (quotient being rounded towards -\infty). -Alexey. ---------------------------------------- Feature #3289: Division of negative numbers http://redmine.ruby-lang.org/issues/3289 Author: Patrick Thomson Status: Assigned Priority: Low Assignee: Yukihiro Matsumoto Category: core Target version: =begin 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. =end -- http://redmine.ruby-lang.org