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?