Re: Print value of p from the infinite series



Lew wrote:
Lew wrote:
while ( (p - Math.PI) < 1E-6 )
or
for ( int i = 1; (p - Math.PI) < 1E-6; i += 2 )

Use your own values for the target and epsilon.

Exuse me, that condition should be inverted

while ( (p - Math.PI) > 1E-6 )

And the absolute value taken.

- Lew with an abashed grin
.