Related to, but not the same question: Distinguishing modulo (Euclidean division) from remainder
There are multiple ways a modulo operation can be performed. Most implementations, in C, for example, use truncated division/modulo. The sign of the result equals the sign of the dividend:
However, most of the time in practice the Euclidean modulo is more useful. The result is always 0 or positive. This leads to idioms along the lines of:
unsigned euclidean_mod(int a, int b) { int m = a % b; return m < 0 ? m + b : m;}
This leads to Euclidean modulo:
My question is, what factors lead the former to be the 'default' in programming languages such as C, even if the latter is more useful in practice?