Partial of Modulo operator ? (with non-integers) I am trying to derive gradient for a special neural network, but got stuck on the Modulo Arithmetic. 
With usual funcitons such as $f(a,x) = a/x$ the partials would be $\frac{1}{x}$ and $-\frac{1}{x^2}$, but am struggling to find such a rule on the internet for Modulo operator. So I have:
$$f(A, x) = A\%x$$ 
 or in other words:
  $$f(A, x) = mod(A, x)$$
This means the value A "wraps around" the value X several times, and spits out remainder.

The trick in my case is A or X are not integers - they can be any real number such as 0.123 etc
$$\frac{\partial f}{\partial A}f(A,x) = ?$$ 
  $$\frac{\partial f}{\partial x}f(A,x) = ?$$
Edit:
$A\%x$  Will be real number (such as 19.123 etc), can be positive, negative, or zero

A reasonable definition for your module-extended-to-reals is a piecewise-defined function:
$$\mod(A,x) = A -nx$$
for $A/x\le n<A/x +1$, $n\in\Bbb Z$.
Partial derivatives will exist in the interior of the chunks.
