Re: Java PI program issue

Can you post the algorithm or show the series that you are using to do the computation?

Why are you using a double to control the number of loop iterations?

Change the coloring of the post. The off yellow is unreadable.

Re: Java PI program issue

That series has a very, very slow convergence; see what happens if you add 1,000,000 terms or so. Do you get a better approximation? b.t.w. your code seems to look correct to me (I didn't give it a very close look, but note that the value of 'user' isn't the number of terms added).

kind regards,

Jos

Re: Java PI program issue

Sorry JoshAH, this is the best i know how to do.

Norm,

I fixed the issues you have addressed with no avail. It still show different numbers at the end.

Quote:

Can you post the algorithm or show the series that you are using to do the computation?

Im not sure what you mean by this. I have not yet learned about algorithms? But ill try to explain, I used the for loop to count all demonimators, then used the sum; fraction; and sign to perform the calculations.

pi = 4(1-1/3+1/5-1/7+1/9-1/11 ... ) and do on.

Re: Java PI program issue

What value do you get if you loop 200M times

Re: Java PI program issue

You must have a very slow computer to have taken so long.

Re: Java PI program issue

Sorry, ill be more prompt next time.