I know it's an unusual function to calculate an uncertainty for, but I haven't been able to figure out a reasonable means for calculating derivatives for it to do so myself. I know modular arithmetic extends to complex values, so I don't think it's a matter of being outside the bounds of integer arithmetic.
I'm halfway through writing a generic class (vb.net) implementing propagation of uncertainty. Since the modulus function is little more than an algorithm built on elementary functions, I could replicate the behavior with the class itself, but I would much rather find a way to perform one simple calculation.
Replicating the modulus function with elementary functions using instances of the class I'm writing to propagate the uncertainty would likely introduce excess rounding error and consume an impractical amount of memory for moderately large operands since garbage collection could get bogged down with intermediate values.
So, I guess the real meat of my question lies in whether or not there are formally defined derivatives for the modulus function. Any thoughts?
So, this only answers to the first of the three possible situations where propagating uncertainty would be necessary: s mod a, a mod s, and s0 mod s1, where a is a real number and s,s0,s1 are real valued statistics.
The modulus may be thought of in the context of the long division algorithm with multiplication carried out manually by sequential addition: the modulus is subtracted an integer number of times to produce a remainder that is a member of the modular ring. In the case of a statistic as the operand and a real number as the modulus, the remainder should have the same uncertainty as the statistic as the algorithm only involves repeated subtraction (a linear operation) of a value with zero uncertainty (the modulus).