By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,346 Members | 2,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

INSANE Pi VALUE CALCULATION!!!!!

daniel aristidou
100+
P: 491
Hi guys....i want to create a program to calculate pi. on a computer...i was gonna chuck in the bin.
Then i thought....why not calculate pi on it for a couple of years?

So now i want to calculate pie!!

Thing is Redundancy is an issue. the values must be stored to harddrive as it is calculated and not to RAM. becuase the value can become very large

i will be using this formula for pi :

pi/4 = 1 -1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - 1/15 .....etc
(hope you can see the pattern)

I think i can use a loop since the value gets smaller the further you go on...only the last part of the number is required each time...So the rest of the digits can be stored to ROM.

so lets Start coding!!!!
But first (because im not an excelent mathematician ...."YET")
If pi/4 = 1 -1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - 1/15 can i do

pi = (4) - 4(1/3) + 4(1/5) - 4(1/7) etc?
May 10 '08 #1
Share this Question
Share on Google+
5 Replies


Dököll
Expert 100+
P: 2,364
But first (because im not an excelent mathematician ...."YET")
If pi/4 = 1 -1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - 1/15 can i do

pi = (4) - 4(1/3) + 4(1/5) - 4(1/7) etc?
Hang in there bud...

Cannot find a way to do this, just letting you to stay tuned, some smart ones may be passing through;-)

Sorry for your troubles!

Dököll
May 11 '08 #2

daniel aristidou
100+
P: 491
Hey.....
Forget about that.....now...it doesnt matter.
What does matter is that i cant get it to calculate more than 30 decimal places.

Does any one have code on how to make extremely large calculations accurate too a couple of thousand decimal places?

Either that...or i think im gonna have to use an array: to hold each decimal place in each row... so that i can create a realy large accurate number.
May 11 '08 #3

daniel aristidou
100+
P: 491
Ok...i now know that im definetly gonna need an array.
which holds only one number " 1 - 9 " In each row.

The problem is how to implement it.
How to have calculations that carry the remainer to the next row etc.
Any ideas anyone?
May 11 '08 #4

jamesd0142
100+
P: 469
Im interested in how you would continue where you left off if for example there was a power cut?

You say you intend to save each value to the hard disk reather than ram, i suppose you will need to store the latest calculation also?

so you can restart from where it left off?

Im not clear but im sure you will get my drift...?

James
May 12 '08 #5

daniel aristidou
100+
P: 491
Im interested in how you would continue where you left off if for example there was a power cut?

You say you intend to save each value to the hard disk reather than ram, i suppose you will need to store the latest calculation also?

so you can restart from where it left off?

Im not clear but im sure you will get my drift...?

James
James..that is exactly what i intend to do.
Though i will save around every 10 minutes or so as not to create too much lag.
I will save the n value reached and the current value of pi.
What i was trying to say before is that when you get to (just theoretical example) 1/10000000 the first 10 digits are correct and no longer need to be saved in ram because they are no longer part of the calculation.because 1/10000000 has a value so small it does not effect the uper regions of pi
I think this is the only advantage of using this calculation technique : thats why im using it

hehe.
ps.using this formula to calculate pi.
will probably take a week in order to accurately calculate the first 10,000 decimals.
May 12 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.