From: "boris_stitnicky (Boris Stitnicky)" Date: 2013-04-26T19:26:29+09:00 Subject: [ruby-core:54600] [ruby-trunk - Feature #3289] Division of negative numbers Issue #3289 has been updated by boris_stitnicky (Boris Stitnicky). Given the context, Ruby choice seems right to me. But the real core of the problem is the minus sign. My father says, that minus simply represents an unfinished operation, intention to subtract. Citing anonymous Wikipedia contributor: "Negative numbers appeared for the first time in history in the Nine Chapters on the Mathematical Art, which in its present form dates from the period of the Chinese Han Dynasty (202 BC. - AD 220), but may well contain much older material. Indian mathematicians developed consistent and correct rules on the use of negative numbers, which later spread to the Middle East and then into Europe. Prior to the concept of negative numbers, negative solutions to problems were considered "false" and equations requiring negative solutions were described as absurd (Diophantus's Arithmetica cited)." My father thinks, that Greek adherence to natural numbers was not due to their backwardness (they eg. knew that �� was irrational), but because complicated objects catering to daily needs of bookkepers were bad elementary blocks for general-purpose applied mathematics. I would like to see basic math rebuilt without reaching for minus (and zero) too early. Relevant Ruby proposal would be: have true natural numbers (class Natural), have morally sound rationals (natural/ natural), and positive floats. Will I try to prototype this myself one day? Regarding zero, which has similar issues as minus signa and is absent from true natural numbers, I wonder how far would one get using nil (or null?) in its stead, like ancient Romans did... ---------------------------------------- Feature #3289: Division of negative numbers https://bugs.ruby-lang.org/issues/3289#change-38923 Author: patrick_thomson (Patrick Thomson) Status: Assigned Priority: Low Assignee: matz (Yukihiro Matsumoto) Category: core Target version: Next Major =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://bugs.ruby-lang.org/