?
Solved

Calculate Value of Pi

Posted on 2006-11-14
3
Medium Priority
?
936 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 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 375 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

765 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