This computes $a\bmod m$ in such a way that the result will always be nonnegative and smaller than $|m|$.
Copyright (c) 2023, Prof. Dr. Edmund Weitz. Impressum, Datenschutzerklärung.