Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi All,
I demonstrating the approximation of Pi by successively computing the perimeters of regular inscribed polygons with 2^n sides. Excel's precision was overwhelmed at about 4000 sides. Is there any way to get "double precision"? If worse comes to worse, I'll use something like BigDecimal in Ruby or Perl to get greater precision. -- Regards, Richard |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Richard,
Excel's precision is 15 significant digits. If you need more, you might take a look at the XNUMBERS add-in: http://digilander.libero.it/foxes/MultiPrecision.htm -- Kind regards, Niek Otten "Richard Lionheart" wrote in message ... Hi All, I demonstrating the approximation of Pi by successively computing the perimeters of regular inscribed polygons with 2^n sides. Excel's precision was overwhelmed at about 4000 sides. Is there any way to get "double precision"? If worse comes to worse, I'll use something like BigDecimal in Ruby or Perl to get greater precision. -- Regards, Richard |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
XNumbers can help with demonstrating the approximation of Pi by succesively
computing the perimeters of regular inscribed polygons with 2^n sides. But for anything requiring fractional powers or fractional roots, you'll need something else, because XNumbers truncates fractional powers and fractional roots to integers. Compare XNumbers to Excel: Excel: =1.98^1.98 (Returns 3.86720395054666) =1.98^(1/1.98) (Returns 1.41198766954688) XNumbers: =xpow(1.98,1.98) (Returns 1.98) =xroot(1.98,1.98) (Returns 1.98) My add-in xlPrecision 2.0 returns fractional powers and fractional roots with up to 32,767 significant digits of precision: =xlpPOWER(1.98,1.98) (Returns 3.867203950546664475197024334694561094821782762326 45703981220472 990158197209281613382250690200215 etc., up to 32,767 digits) =xlpROOT(1.98,1.98) (Returns 1.411987669546878795740148157203790542076237995834 60566043557515 9344161656315787429344740444142505 etc., up to 32,767 digits) You can download the free edition of xlPrecision 2.0 here, and use it as long as you wish: http://PrecisionCalc.com Thanks, Greg Lovern http://PrecisionCalc.com Get Your Numbers Right "Niek Otten" wrote in message ... Excel's precision is 15 significant digits. If you need more, you might take a look at the XNUMBERS add-in: http://digilander.libero.it/foxes/MultiPrecision.htm "Richard Lionheart" wrote in message ... I demonstrating the approximation of Pi by successively computing the perimeters of regular inscribed polygons with 2^n sides. Excel's precision was overwhelmed at about 4000 sides. Is there any way to get "double precision"? If worse comes to worse, I'll use something like BigDecimal in Ruby or Perl to get greater precision. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If interested, here's a newer version. I removed 5 multiplications per
loop, for a savings of about 95+ Multiplications. Here's the output from the immediate window. The last digit will usually be off a little. Real Pi= 3.1415926535897932384626433832795.... My Pi= 3.1415926535897932384626433834 Again, not the fastest convergence, just one of the simplier versions for Excel. -- Dana DeLouis Win XP & Office 2003 Sub TestIt() Debug.Print "Real Pi= " & "3.1415926535897932384626433832795...." Debug.Print " My Pi= " & Pi End Sub Function Pi() As Variant '// = = = = = = = = = = = = = = = = = = = = = '// Pi = 16*ArcTan(1/5) - 4*ArcTan(1/239) '// By: Dana DeLouis '// Note: Pi = 3.1415926535897932384626433832795... '// = = = = = = = = = = = = = = = = = = = = = Dim Two Dim Den Dim d5 Dim d239 Dim p1 Dim p2 Dim j As Long Den = CDec(1) Two = CDec(2) d5 = Den / 5 d239 = Den / 239 '// First loop w/ j=0 p1 = d5 p2 = d239 Pi = (4 * (4 * p1 - p2)) / Den '// Newer values... d5 = d5 * d5 d239 = d239 * d239 '// Then... For j = 1 To 10 p1 = p1 * d5 p2 = p2 * d239 Den = Den + Two Pi = Pi - (4 * (4 * p1 - p2)) / Den p1 = p1 * d5 p2 = p2 * d239 Den = Den + Two Pi = Pi + (4 * (4 * p1 - p2)) / Den Next j End Function -- Dana DeLouis Win XP & Office 2003 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Precision as displayed problems | Excel Worksheet Functions | |||
Is there a way to count higher than 511 in binary in excel? | Excel Worksheet Functions | |||
Precision displayed does not match precision in cell | Excel Discussion (Misc queries) | |||
comparing a value in a cell to see if it is higher than a number | Excel Worksheet Functions | |||
Precision as displayed | Setting up and Configuration of Excel |