I'd just use a constant.Quote:
I don't care - would just do 4 * arctan(1.0) anyway.
Soma
Printable View
I'd just use a constant.Quote:
I don't care - would just do 4 * arctan(1.0) anyway.
Soma
I might do the loop more like this:
but to each his own.Code:double numerator = -1.0
double taylor = 1.0;
for (int i = 3; i < terms; i+=2, numerator *= -1)
{
taylor += numerator/i;
}