Why are these two snippets of code giving two different results?
double sum = 1.0;
double xSqFour = x * x / 4;
for (int i = 48; i > 1; i-=2) {
sum = 1.0 + (xSqFour / ((i/2) * (i/2))) * sum;
}
return sum;
and
double sum = 1.0;
double xSqFour = x * x / 4;
for (int i = 24; i > 1; i--) {
sum = 1.0 + (xSqFour / (i * i)) * sum;
}
return sum;