In message "[ruby-talk:03125] Re: Is divmod dangerous?"
    on 00/06/06, Dave Thomas <Dave / thomases.com> writes:
>> |                         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.
>
>It seems as if changing division so that 13/-4 -> -4 is a popular
>option, perhaps keeping the current behavior as a new method. a%b
>would then become a synonym for a.remainder(b).

At first, [a/b, a/%] (== a.divmod) can be considered equivalent to
div(a,b) in C language. Fortran's / and MOD too. I think, however,
these symmetry wrt 0 is not convenient even in numerical experiments.
Sometimes we physicists prefer both of quotient and modulo periodic
functions wrt numerator and denominator, i.e., for numerator a and
denominator b,

  quotient q := floor(a/b)
  modulo   m := a - b*q

where I means mathematical operators by floor and /. 

But, I don't feel that Ruby's operators is not necessary to change; 
their definitions are well reasonable.  

-- gotoken