# How is statistical uncertainty calculated for the modulus function?

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?

• One thought that came to mind overnight is the extant geometric interpretation that naturally arises from polar coordinates: the angle coordinate forms a ring that is naturally, or unnaturally if you favor tau, modulo 2*pi. This still leaves the issue of specifying an appropriate means of propagating uncertainty unanswered if the modulus defining a ring in the set of real numbers is itself a statistic. At this point, the other of the two propagations of error for a single statistic may be defined, which I will put in an answer below. Jan 23, 2014 at 18:33