Announcement
Collapse
No announcement yet.
Re: 'Code Wanted: Calculate Pi in PB_DOS' from Source Code Forum
Collapse
X
-
Hello Frank,
here's some old PB/DOS code
http://www.pbhq.de/filebase/fdb110.html#CALC-PI.BAS
Best wishes,
Thomas
## Mozilla/5.0 (Windows; U; Win98; de-DE; rv:1.0.2) Gecko/20030208 Netscape/7.02 Hamster/2.0.5.5, via PBNEWS v0.45g (news.pbhq.de)
-
The LONGPI code for PB/Win can probably be translated...
http://powerbasic.com/files/pub/pbwin/misc/
------------------
Tom Hanlin, PowerBASIC Staff
Opinions expressed may not be those of my employer or myself
Leave a comment:
-
Re: 'Code Wanted: Calculate Pi in PB_DOS' from Source Code Forum
Original question posed in the Source Code forum..
Frank,
Here is some text snipped from PB's docs:
Pi is a transcendental constant, meaning that it has an infinite number of decimal places.
To 15-place accuracy, adequate for most applications, p = 3.141592653589793##.
This value can be closely approximated with the expression:
pi## = 4 * ATN(1)
..
The ATN function always returns an Extended-precision result.
..
Extended-precision values require 10 bytes of storage each.
They have a range of approximately +/- 3.4x10^-4932 to 1.2x10^4932,
and offer 18 digits of precision. All 18 digits can be "displayed" using
the extended STR$ format (eg, STR$(var##,18))
Code:pi## = 4 * ATN(1) For X& = 1 to 18 Pi$ = Str$(pi##, x&) Print Pi$ next
Rgds Dave
------------------
Tags: None
Leave a comment: