Interestingly, if either bound in the integral is floating point, it gives me -pi and if I use an integer lower bound and a floating point 0.99999 upper bound, I still get -pi. But, if I use floating point -0.99999 as lower bound and integer 1 upper bound, it gives me +pi. This also works if the upper bound is 1.0.
Interestingly, y with t set to 0.99999 is +pi, but my output 42 should be equivalent to that and it is -pi. Is anyone able to interpret what is going on?
It is the order of evaluation. In one example the integral is computed with a symbolic endpoint first, and then the symbol is replaced with numbers. In the other example the numeric endpoint is generated first, and then the integral is computed. It appears that different integration algorithms are called in the two situations, with different branch cuts.