~amaurycarvalho/msxbas2asm/trunk

« back to all changes in this revision

Viewing changes to test/demos/pi.bas

  • Committer: Amaury Carvalho
  • Date: 2020-06-12 13:08:59 UTC
  • Revision ID: amauryspires@gmail.com-20200612130859-3qm5vl1jiqr2brok
Commit on 12/06/2020 10:08:59  -03 by amaury

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
10 REM Leibniz formula for PI
 
2
20 REM https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80
 
3
30 CLS
 
4
40 X = 1
 
5
50 I = -1
 
6
60 Y = 1
 
7
70 K = X * 2 + 1
 
8
80 Y = Y + ( I / K )
 
9
90 I = I * -1
 
10
100 X = X + 1
 
11
110 PI = Y * 4
 
12
120 DI = PI - 3.1415926536
 
13
130 PRINT PI; " "; DI
 
14
140 GOTO 70
 
15