atan2(sin(x),cos(x)) achieves the same computation as
fabs(x,2*pi()). The manual warns that
fabs() can induce sampling issues; would the same issues apply to the atan2 version?
Warning is due to possible discontinuity in gradient. The same applies for any function which may produce discontinuity in gradient.
Gotcha. I have nil training in calculus; presumably
atan2(sin(x),cos(x)) has a discontinuous gradient?
At n*pi, the derivative is undefined because the function is discontinuous.
The gradient is a function of the function. If you put the same function in, you get the same gradient function out. There’s no way to save a discontinuous function by reformulating it, but it’s sometimes possible to destroy a well-defined function by numerical issues in the chain rule.