Post Reply 
Gerson's Pi Program
03-01-2022, 11:41 AM (This post was last modified: 03-01-2022 04:12 PM by Gerson W. Barbosa.)
Post: #8
RE: Gerson's Pi Program
(03-01-2022 09:39 AM)EdS2 Wrote:  Very nice! I'd like to port it to BBC Basic, where we have 4 byte integers and 5 byte floats. But it's not working... any ideas?

Minor notes:

The DEFINT are ignored, because in BBC Basic we need to decorate integer variables with % suffix. I was hoping that would merely be a speed advantage as the 5 byte floats are very nearly as good as the 5 byte ints for accuracy and range.

I took the ! off the end of the B=100000000 but I don't know what it means.

I changed the \ operators to DIV, guessing that this is what's meant.

B stands for base. Default variable types in MSX are double precision (8 bytes, 14 significant digits), which allows for bases as high as 10000000. With 9-digit precision, you should choose base = 10000 or perhaps 100000. The \ operator is the integer division, as you have correctly guessed. The exclamation sign says it's a single precision number.

Try changing lines 80 and 440:

80 B = 10000: N=ND DIV 4 + 2: K=ND*12 DIV 25 + 1

440 M=10*LOG(ND)/LOG(1000)

For 30 digits the output should be

3 1415 9265 3589 7932 3846 2643 3832 7941


P.S.: For a much faster program, you might want to try Katie Wasserman's program for the HP-71B:

CALCULATING MANY DIGITS OF PI
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Gerson's Pi Program - EdS2 - 12-28-2020, 11:20 AM
RE: Gerson's Pi Program - Allen - 12-28-2020, 01:15 PM
RE: Gerson's Pi Program - EdS2 - 12-29-2020, 09:15 AM
RE: Gerson's Pi Program - EdS2 - 03-01-2022, 09:39 AM
RE: Gerson's Pi Program - Gerson W. Barbosa - 03-01-2022 11:41 AM
RE: Gerson's Pi Program - EdS2 - 03-02-2022, 11:17 AM
RE: Gerson's Pi Program - EdS2 - 03-04-2022, 04:50 PM
RE: Gerson's Pi Program - Valentin Albillo - 03-08-2022, 05:42 PM
RE: Gerson's Pi Program - EdS2 - 03-10-2022, 07:47 AM
RE: Gerson's Pi Program - Valentin Albillo - 03-10-2022, 11:48 AM
RE: Gerson's Pi Program - Ángel Martin - 03-09-2022, 08:12 AM
RE: Gerson's Pi Program - EdS2 - 03-11-2022, 12:42 PM
RE: Gerson's Pi Program - EdS2 - 03-15-2022, 07:44 AM



User(s) browsing this thread: 1 Guest(s)