summaryrefslogtreecommitdiff
path: root/test.r1
blob: 8a51d81ed3b97b3cc4c5e8d9586d7c22fece037c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
: sqrt
i mark2 dup
i loc0 sto
c /2
i loc1 sto
% loop
i loc0 lod
i loc1 lod
c newton
i dup loc1
c replace!
c thresh
c close?
b loop
i loc1 lod
i ret2

: newton
c tuck
c square
i add div
c /2
i ret0

: square
i dup mul
i ret0
: tuck
i dup nrt
i ret0 

: replace!
i dup lod
i nrt sto
i ret0

: close?
i nrt
c absdiff
i swp sle
i ret0

: /2
i lit2 div
i ret0

: thresh
i lit4 ret0

: absdiff
i sub 

: abs
i lit0 slt
b f1
i neg
% f1
i ret0


: hypot
c square
i swp
c square
i add 
c sqrt
i ret0