As a Mathematician I would like:

Stephen Montgomery-Smith stephen at math.missouri.edu
Fri Jun 29 17:13:08 PDT 2007


S. wrote:
> Stephen Montgomery-Smith Wrote:
> 
>> 2. a%b has a very definite and unambiguous meaning when a is negative, 
>> and b is positive. The output should be non-negative. This is something 
>> perl has done right.  For example (-6)%7 is 1.
> 
> That's not true.  There is two definitions of the 'mod' operator for negative numbers.  Depends on how you define the operator itself.
> 
> -6%7 is equally 1 or -6. 
> 
> Long division makes extensive use of remainders for calculations, if you were to say the initial calculation was 7*-1 remainder 1, then you would have a very wrong answer doing division by hand.
> 
> See: http://en.wikipedia.org/wiki/Modulo_operation
> and http://mathforum.org/library/drmath/view/52343.html

After reading these, I get the sense that they side a lot more with my 
position, vis (-6)%7=1.

Long division as I have used it never has negative numbers in the 
remainder operations.



More information about the Digitalmars-d mailing list