Alright I'm having lots of trouble estimating pi using this series. I must be missing something.

My book says you can estimate pi using this series:

I'm sure a lot of you are familiar with this.Code:pi = 4( 1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - ... (-1 / 2i - 1) + (1 / 2i + 1) )

This is my code:

My outcomes are always like 4.45264 ... I'm thinking it has to do with my parenthesis, but I've rearranged them so many times I can't figure it out. Also, data2 is just some arbitrary value that the user enters.Code:double sum = 0; for(int i = 0; i <= data2; i++){ sum += ((- (1.0 / (2.0 * i - 1.0))) + (1.0 / (2.0 * i + 1.0))); } sum *= 4.0;

Any help would be greatly appreciated. I'm pretty stuck on this.