Solved

Calculate Value of Pi

Posted on 2006-11-14
3
914 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 127
MsgBox 2 61
VBS file using code from 2nd file (txt or vbs) 4 48
Export PDF Form fields to Access  or Excel  in Tab order 16 113
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 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