diff options
author | ubq323 <ubq323@ubq323.website> | 2024-05-02 21:06:41 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-05-02 21:06:41 +0100 |
commit | 20ddcf5e3733677b695d50d86d65c8de5b386e60 (patch) | |
tree | 94f430b0c89af489b31eaec9dde79fc8070786b6 /testa.r1 | |
parent | 1f6ed601a14ef9bb6651a9ff0000155929473d0c (diff) |
oeu
Diffstat (limited to 'testa.r1')
-rw-r--r-- | testa.r1 | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/testa.r1 b/testa.r1 new file mode 100644 index 0000000..79e6352 --- /dev/null +++ b/testa.r1 @@ -0,0 +1,63 @@ +: sqrt +i mark2 dup +i loc0 sto +i lit2 div +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 +i lit2 div +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 + +: 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 |