Q: Feature Wish: "%" Extension
Tim Peters
tim.one at home.com
Sun Nov 4 22:15:35 EST 2001
[Jive Dadson]
> I work in robotics. Our robots have several rotary axes, each of which
> can turn considerably more than 360 degrees. The positions 5 degrees
> and 365 degress are not equivalent, because the arms can contain wires
> and tubes that can only be twisted so many times. I am continually
> using the following function, often to "mod out" multiples of 360
> degrees.
>
> // "Floating point modulus" function
> inline double fpMod(double x, double modulus) {
> return x-floor(x/modulus)*modulus;
> }
Why do you use that instead of the platform fmod() function? Is it
important that the result be non-negative in this application?
More information about the Python-list
mailing list