Solved

Calculate Value of Pi

Posted on 2006-11-14
3
910 Views
Last Modified: 2008-02-01
I remeber a LONG time ago (1981-1982), coming across a BASIC program that would calculate the value of Pi to a specific number of decimal places. It stored each 'digit' in an array element and then when the calculation was complete, just concatenated all of the digits. It was limited by memory size (how large you could dimension the array).

I know the need for a value of Pi to any more than 5 or 6 decimal places is probably overkill unless you are trying to aim a rocket at a star a few million light years from earth, but I recall it was kind of fun to have a sheet of paper filled with digits and telling everyone it was Pi to 1,200 decimal places (or whatever it was-back in the days of 64K RAM you were kind of limited).

Does anyone have a similar VB program laying around just gathering dust? As I recall, with my old system (it was even before the days of the IBM PC), it took almost 3 days to calculate Pi to whatever the limit was (as I recall, it was around 1,200 decimal places).

Doug
0
Comment
Question by:dbbishop
3 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17941259
0
 
LVL 15

Author Comment

by:dbbishop
ID: 17944855
These are 'okay' but give a limited value of Pi. Using Atn() or a series limits the value to can return to the number of digits supported by the number type you use within your OS. The neat thing about the iteration I recall is that, as I stated, each digit was stored in an element of a string array and after calculating 1000 elements, you just concatenated all the elements together. I believe you started out with 3.14 and went from there. So whatever the calucation was, at the end you ran code similar to:

Print "3.14";
For i = 0 to UBound(a)
    Print a(i);
Next i
Print

Each element in a() was just a single digit. As I recall, the program used a couple of nested For...Next loops and was written in BASIC. Anyone out there with fond memories of such a program?
0
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 125 total points
ID: 17945003
Found this:

http://www.po28.dial.pipex.com/maths/software.htm

About half way down the page is VB source code to do what you want.

Kevin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now