That's not a C++-related problem. The page tells you everything you need to know about fmod.
But well, since this probably ain't leading nowhere:
Add this line as the first line of your functions (you'll need to include cmath): x=fmod(x,M_PI*2);
With that, you can reduce limit to something around 25.
Also, you need to use the double type for result and term as well, otherwise there'll be no difference.
The second formula is the one being used in the functions here. Your recent post for the cos() implements it on line #12. Methods based on both formulas were explored in this recent post: http://www.cplusplus.com/forum/general/26540/. Mind though what Athar has said about using arguments (values for x) that the series converges for. For the trig. series being considered this is -PI to +PI. You may expect values given outside this range to produce garbage for output!