The function Integrate fails to integrate correctly over a definite domain a certain continuous and differentiable rational function of trigonometric expression (see attached Mathematica 9 notebook with outputs and the comments therein).The corresponding numerical integration via NIntegrate as well as the plot of the function is used as a test. Could this be a bug or do I have a problem in my understanding? Fortunately, I have found a partial workaround which is also indicated in the file. Breaking the integral into two parts and a certain substitution seems to work. I am extremely curious on getting some insights on what is going wrong and how I can avoid this problem.
I also appear to be getting some unexpected results in this example... Will try to have a closer look later.
It's a bug (and will be fixed). Your workaround, to make the integration bounds positive, should suffice.
Also, it is generally safer to use exact input and, if that is not an option, input precision that is higher than MachinePrecision. Even with code improvements I am not sure this example will be working correctly at machine precision.