38 lines
361 B
Text
38 lines
361 B
Text
|
|
|Trabb Pardo–Knuth algorithm
|
|||
|
|
|
|||
|
|
a : 11 0
|
|||
|
|
|
|||
|
|
i
|
|||
|
|
if i LE 10
|
|||
|
|
[] $s
|
|||
|
|
~ $s w
|
|||
|
|
w a.i
|
|||
|
|
+ i
|
|||
|
|
goif
|
|||
|
|
endif
|
|||
|
|
10 i
|
|||
|
|
if i GE 0
|
|||
|
|
call f
|
|||
|
|
if x GT 400
|
|||
|
|
'too large' $s
|
|||
|
|
else
|
|||
|
|
~ x $s
|
|||
|
|
endif
|
|||
|
|
~ i $r
|
|||
|
|
+ ' ' $r
|
|||
|
|
+ $r $s.1
|
|||
|
|
$s []
|
|||
|
|
- i
|
|||
|
|
goif
|
|||
|
|
endif
|
|||
|
|
stop
|
|||
|
|
|
|||
|
|
f a.i t
|
|||
|
|
* t t x
|
|||
|
|
* x t x
|
|||
|
|
* 5 x
|
|||
|
|
abs t
|
|||
|
|
sqrt t y
|
|||
|
|
+ y x
|
|||
|
|
return
|