From: "Aleksi Niemelä" Date: 2000-06-06T10:19:15+02:00 Subject: [ruby-talk:03111] RE: Is divmod dangerous? Dave: > If (q, r) = divmod(x, y) > then x = q*y + r > I suspect most people would expect > divmod to return a remainder, not a modulus. I surely do expect something. But not as you suspected. I would guess divmod returns array where ary[0] == x / y and ary[1] == x % y, that is to really return modulus. I'd guess divrem to return remainder. If the original idea has to be preserved to have x == ary[0] * y + ary[1] I've out of luck. I think we should have (Python style) a/b operation around where (a/b) * b + a%b = a. I can't invent any good name for this now, but it's still morning after all. Then I could group Python style a/b with % and Ruby a/b with remainder. Strangely enough I've thought these to be different operations. I have to go back to the assembler time :). Anyway, - Aleksi