View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dana DeLouis
 
Posts: n/a
Default Higher precision: can one get it?

Hi. For the op, ... Is there any way to get "double precision"?

Not sure if you would find this interesting...
If you would like to "double" your precision, here is one method to
calculate Pi using ArcTan and just built-in functions.
This is not the fastest convergence, but it is simple. It reaches Excel's
limit in 20 loops. Maybe you can adopt it to your method.
If you would like to get real crazy, then Excel has a Fast Fourier Transform
function in the analysis toolpak that you can use to multiply large numbers
very quickly. However, Excel's built-in FFT is limited to 4096 digits.

Sub TestIt()
Debug.Print "Pi= " & Pi
End Sub

Function Pi() As Variant
'// = = = = = = = = = = = = = = = = = = = = =
'// Pi = 16*ArcTan(1/5) - 4*ArcTan(1/239)
'// By: Dana DeLouis
'// = = = = = = = = = = = = = = = = = = = = =
Dim One
Dim Two
Dim d5
Dim d239
Dim p1
Dim p2
Dim f
Dim j As Long

One = CDec(1)
Two = One + One
d5 = One / 5
d239 = One / 239
f = One

'// The first loop w/ j=0
p1 = d5
p2 = d239
Pi = Pi + (4 * f * (4 * p1 - p2)) / One
f = -f
'// Then...
For j = 1 To 19
p1 = p1 * d5 * d5
p2 = p2 * d239 * d239
Pi = Pi + (4 * f * (4 * p1 - p2)) / (One + j * Two)
f = -f
Next j
End Function

HTH. :)
--
Dana DeLouis
Win XP & Office 2003


"Richard Lionheart" wrote in message
...
Hi Niek and Greg ,

Thank you very much for your responses.

I downloaded the XNumbers addin and got great results. I showed my 12yo
grandson the algebra for calculating perimiters of regular inscribed
polygons using recursion and showed him the results in Excel. We compared
these with published estimates of Pi to hundreds of places. Got a
favorable comparison up to 10 places using 60 places for intermediate
results and 32 iiterations.

I'll check out xlPrecision a little later. Right now I've only got
integral exponents to deal with.

Best wishes,
Richard