I am having trouble actually really understanding the modulo congruence.
I understand it intuitively very well. However, I fear that my background in development is not helping.
Writing:
$x \equiv y \pmod m$
Means that both $X$ and $Y$ belong have the same remainder after being divided by $m$. For example:
$17 ≡ 20 \pmod 3$
As they both belong to the same "class" of numbers with a reminder of $2$ when divided by $3$.
In MATHEMATICAL CRYPTOLOGY by Keijo Ruohonen confirms this:
The congruence $x ≡ y$ $mod$ $m$ says that when dividing $x$ and $y$ by $m$ the remainder is the same, or in other words, $x$ and $y$ belong to the same residue class modulo $m$
Then, a specific case comes by.
$59 ≡ -1 \pmod{60}$
Here my understanding breaks down. They both clearly belong to the same class (the numbers being "behind" one of $60$ as multuple, intuitively speaking). However, dividing $x$ and $y$ by $m$ the remainder is the same (Ruohonen) is no longer true, since $59 % 60 = 59$, and $-1 % 60 = -1$.
What am I missing?
%modulo operator, whose behavior is implementation defined and can be negative, as you just found out. – dxiv Dec 30 '17 at 06:18a % bis not a foolproof test here. See my comment zipirovich's answer for more. The definition described by anomaly is the usual one (though yet another version is easier to generalize to other rings). – Jyrki Lahtonen Dec 30 '17 at 08:00a % balways has the same sign asb. – PM 2Ring Dec 30 '17 at 14:10