Sub PiFractions()
Dim dividend As Integer, divisor As Integer, quotient As Double
Dim rowpointer As Byte
rowpointer = 1
For dividend = 22 To 10000
For divisor = 7 To dividend \ 3
quotient = dividend / divisor
If quotient > 3.14159 And quotient < 3.1416 Then
Cells(rowpointer, 1) = dividend
Cells(rowpointer, 2) = divisor
Cells(rowpointer, 3) = quotient
rowpointer = rowpointer + 1
End If
Next
Next
End Sub
Pete
"Pete_UK" <pash...@auditel.net> wrote in message
news:1144013707.0...@e56g2000cwe.googlegroups.com...
Hi. At 15 digits, I believe the minimum fraction for Pi is:
=80143857/25510582
As a side note, the limit in vba is:
Num = 428224593349304#
Den = 136308121570117#
Debug.Print CDec(Num) / Den
' 3.1415926535897932384626433833
--
HTH. :>)
Dana DeLouis
Windows XP, Office 2003
"Spaz" <ye...@right.com> wrote in message
news:svKdndamzu_...@comcast.com...
? application.pi()
3.14159265358979
or in the worksheet
=pi()
and format the cell to show 14 decimals.
--
Regards,
Tom Ogilvy
"Spaz" <ye...@right.com> wrote in message
news:3uadncd2utpC2q3Z...@comcast.com...
If you want to write a routine that will handle more precision than Excel
natively gives, you might find the VBA code at that last link instructive.
There are some Excel add-ins like
http://digilander.libero.it/foxes/index.htm
http://precisioncalc.com/
that already implement higher precision.
Also there are commercial packages like Maple, Mathematica,
MacSyma and open source packages like Maxima
http://maxima.sourceforge.net/
that implement algebraic math and user-specified numeric precision.
Jerry
Sub Demo()
Dim s As String
s = WorksheetFunction.Rept("?", 16)
s = s & "/" & s
Range("A1").FormulaR1C1 = "=PI()"
Range("A1").NumberFormat = s
Debug.Print Range("A1").Text
End Sub
5419351/1725033
As you can see, the fraction format can get close(~14), but not quite...:>(
--
HTH. :>)
Dana DeLouis
Windows XP, Office 2003
"Dana DeLouis" <ddel...@bellsouth.net> wrote in message
news:OvEepNqV...@TK2MSFTNGP14.phx.gbl...
"Dana DeLouis" <ddel...@bellsouth.net> wrote in message
news:uQz2X0rV...@TK2MSFTNGP14.phx.gbl...
355/113
--
Regards,
Tom Ogilvy
Jerry