
25 Sep
2007
25 Sep
'07
10:53 p.m.
[Concerning the fact that fmod(x,y) = -fmod(-x,y)] I wrote:
Interesting, perhaps. Surprising, no. fmod() is basically there for the sake of sin(), cos(), and tan() (or any other periodic and either symmetric or antisymmetric function).
On 25 Sep 2007, at 8:58 pm, Henning Thielemann wrote:
Why is this particular behaviour useful in connection with trigonometric functions?
Range reduction. sin(x) = sin(fmod(x, M_TWOPI)). Whether that is the *best* way to handle range reduction is another matter. (Amongst other things, there are modern algorithms that get a result as if the range reduction had been done with an infinitely precise pi. I have no idea how they do that.)