Happy pi day - March 14th

Discussion about ZX80 / ZX81 Software
Post Reply
ZX79
Posts: 6
Joined: Wed Apr 06, 2016 9:36 pm

Happy pi day - March 14th

Post by ZX79 »

It was reported today that the record for pi is 31 trillion digits.

I don't know if this has been established already, if not, as a pi day challenge:

What is the most accurate approximation of pi that can be calculated using either the expanded or unexpanded ZX80?

Here are some suggestions for calculating pi:

https://en.wikipedia.org/wiki/Approximations_of_π
www.mathworld.wolfram.com/PiApproximations.html

Note, 10 PRINT "3.141592653589793" or similar, does not count. :-)
User avatar
GCHarder
Posts: 427
Joined: Sat Dec 14, 2013 7:46 pm

A Program to Calculate Pi

Post by GCHarder »

The author claims over 8000 decimal places in 16K. Presumably more with extended RAM.

Regards;

Greg
Attachments
Pi.gif
Pi.gif (6.55 KiB) Viewed 6646 times
Pi (Syntax v5n01).zip
(9.13 KiB) Downloaded 336 times
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: Happy pi day - March 14th

Post by Moggy »

Very late in the day I know but somehow I missed this.

The author of this program also published it in Sync magazine minus the any key to continue thing but although the code looks the same it doesn't work very well. by that I mean every odd iteration the answer is miles out with PI starting as 3.14159... first time around then 3.175065.....then occasionally giving a correct result.

Is it possible any of our programming gurus could put me out of my misery because apart from the 2 different display methods it all looks the same to me?

The attached P file PI2 is the version published in Sync Vol 3 number 6 and P1 is the version kindly supplied by Greg.
Attachments
pi2.p
(2.73 KiB) Downloaded 329 times
Pi.p
(2.41 KiB) Downloaded 303 times
olofsen
Posts: 189
Joined: Wed Jan 08, 2014 12:29 pm

Re: Happy pi day - March 14th

Post by olofsen »

Changing line 220 in pi2.p to the one in pi.p seems to help - so

Code: Select all

220 LET S=-1
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: Happy pi day - March 14th

Post by Moggy »

Many many thanks for this Erik. :D

Just 1 character incorrect causes such error! It is very pleasing that there's always someone who will help those such as myself who are not so smart, I really do love this community and have learned so much from it.

Thanks again, Erik.

Fred.
User avatar
stefano
Posts: 542
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Happy pi day - March 14th

Post by stefano »

Very late.. but this article must be in the loop:

https://github.com/z88dk/z88dk/wiki/pi
Post Reply