-
September 27th, 2010, 06:37 PM
#1
Pi Calculator
I'm writing a program that calculates Pi in C and i'm using a double data structure to store the final result. Double only gives me a certain amount of digits after the decimal point. My question is, what kind of data structure or what method could I use if I potentially wanted to have it calculate 100 digits or more after the decimal point?
-
September 28th, 2010, 01:47 AM
#2
Re: Pi Calculator
You need a package for arbitrary-precision arithmetics,
http://en.wikipedia.org/wiki/Arbitra...ion_arithmetic
-
September 28th, 2010, 08:16 AM
#3
Re: Pi Calculator
If your need is to simply determine the digits in PI and not use this extended precision number in any calculations, then all you need is an algorithm. Sorry that I can't suggest one, but a Google search should turn up several sources - or maybe someone here could recommend one.
To clarify: the extended precision digits could be stored in an array of integers or as ASCII characters in a string. Obviously, if stored this way you would not be able to use the value in any calculations.
-
September 28th, 2010, 02:28 PM
#4
Re: Pi Calculator
Thx for the inputs. I'll look into arbitrary precision arithmetic.
-
September 28th, 2010, 08:26 PM
#5
Re: Pi Calculator
gmp is a common and easy to use one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|