Problems using modulo

Gonzalo Sainz-Trápaga (GomoX) gomoSINSPAM at datafull.com
Mon Apr 19 17:29:49 EDT 2004


On Mon, 19 Apr 2004 17:51:53 +0200, Diez B. Roggisch wrote:
> AFAIK modulo is mathematically only properly defined on
> integers - so you should stick to them.

Modulo is fine for any number (even irrational ones). For example,
acos(sqrt(3)/2) is congruent to pi/6 mod 2*pi. Technically, two numbers
are congruent mod n when the rest of the division by n is the same, it
doesn't matter whether n is an integer or not.





More information about the Python-list mailing list