Dotan Cohen wrote: > FIrst of all, how is the % symbol (as in 70%6=4) called in English?
The operator is usually called "mod". (The symbol is usually called "percent".) I reserve "modulo" for its usage in mathematics. 70 modulo 6 is an equivalence class containing infinitely many integers. In math talk, 4 is the least residue of 70 modulo 6. > Second, in Turbo C -111%10=-1 however in python -111%10=9. Is one or > the other in error? Turbo C is correct here with respect to the C standard. Python is correct with respect to the Python Reference Manual. They also disagree about integer division. C rounds toward zero; Python rounds downward. In C: -111 / 10 evaluates to -11 In Python: -111 / 10 evaluates to -12 > Is this a known gotcha? I tried to google the > subject however one cannot google the symbol %. I think it's a known gotcha. I cited the refs in another post. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list