From: matz@... (Yukihiro Matsumoto) Date: 2000-06-06T18:50:27+09:00 Subject: [ruby-talk:03117] Re: Is divmod dangerous? Hi, In message "[ruby-talk:03109] Is divmod dangerous?" on 00/06/06, Dave Thomas writes: |In Ruby, % is a true modulo operator, and a.remainder(b) is used to |get the remainder. | | Ruby Python | a b | a/b a%b a.remainder(b) | a/b a%b |============|=============================|================= | 13 4 | 3 1 1 | 3 1 | 13 -4 | -3 -3 1 | -4 -3 | -13 4 | -3 3 -1 | -4 3 | -13 -4 | 3 -1 -1 | 3 -1 | |Why do we care, you ask? Ruby basicly follows R5RS of Scheme. / works as quotient, % works as modulo, remainder works as remainder. And divmod returns array of [quotient, modulo]. Maybe divrem should be defined. If this behavior raises any confusion, I'd like to change iff consensus is made. matz.