Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Continued-fraction/BBC-BASIC/continued-fraction.basic
Normal file
16
Task/Continued-fraction/BBC-BASIC/continued-fraction.basic
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
*FLOAT64
|
||||
@% = &1001010
|
||||
|
||||
PRINT "SQR(2) = " ; FNcontfrac(1, 1, "2", "1")
|
||||
PRINT " e = " ; FNcontfrac(2, 1, "N", "N")
|
||||
PRINT " PI = " ; FNcontfrac(3, 1, "6", "(2*N+1)^2")
|
||||
END
|
||||
|
||||
REM a$ and b$ are functions of N
|
||||
DEF FNcontfrac(a0, b1, a$, b$)
|
||||
LOCAL N, expr$
|
||||
REPEAT
|
||||
N += 1
|
||||
expr$ += STR$(EVAL(a$)) + "+" + STR$(EVAL(b$)) + "/("
|
||||
UNTIL LEN(expr$) > (65500 - N)
|
||||
= a0 + b1 / EVAL (expr$ + "1" + STRING$(N, ")"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue