Post Reply 
[VA] SRC#006- Pi Day 2020 Special: A New Fast Way to Compute Pi
03-18-2020, 09:51 AM
Post: #16
RE: [VA] SRC#006- Pi Day 2020 Special: A New Fast Way to Compute Pi
.
(03-17-2020 07:43 PM)Valentin Albillo Wrote:  As for fast computation of sin(x), these papers and link are interesting and relevant:
Thanks for the pointers!

Quote:I saw you mentioned my fast program here ...
https://stardot.org.uk/forums/viewtopic....2&p=262553

... but you modified the code ...

In the future, I would appreciate it if, when giving me credit for some code I wrote, you don't modify my code in any way (apart from adapting it to some particular programming language) without clearly stating that you modified my original code...
Understood, apologies, and I've added a note to that post.

It seems to me that any strictly positive starting value less than pi will converge to pi - is that not so?

About the wonderful and unexpected rnd/rnd code:
Quote:I suggest you check what you keyed in, if there's a typo it certainly is on your side.
Hmm. I must be missing something. Here's your posted code:

Code:
      1   DESTROY ALL @ RANDOMIZE 1 @ FOR K=1 TO 5 @ N=10^K @ S=0
      2   FOR I=1 TO N @ IF NOT MOD(IROUND(RND/RND),2) THEN S=S+1
      3   NEXT I @ P=S/N @ STD @ DISP N, @ FIX 3 @ DISP 5-P*4 @ NEXT K
previously posted in this slightly different form:
Code:
    10 INPUT K @ N=0 @ FOR I=1 TO K @ N=N-MOD(IROUND(RND/RND),2) @ NEXT I @ DISP 1-4*N/K
and here's mine, in BBC Basic:
Code:
   10 FOR K=1 TO 7
   20 N%=10^K
   30 S%=0
   40 FOR I=1 TO N%
   50 S%=S%+INT(RND(1)/RND(1)+.5)MOD 2
   60 NEXT
   70 PRINT N%,1+4*S%/N%
   80 NEXT
Evidently something is somehow slightly different.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC#006- Pi Day 2020 Special: A New Fast Way to Compute Pi - EdS2 - 03-18-2020 09:51 AM



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