#10. Integer Division

Note

If you have any ideas or enhancements for this page, please edit it on GitHub!

Following documentation is a cooperative result combined from our Discord chat and numerous pull requests. Thanks to everyone who helped!

Image

This image was produced from the tenth radio transmission using previously contributed code.

This partly annotated version of the image was made using code from message #3.

Interpretation

The new operator is consistent with integer division which rounds toward zero.

Decoded

div
ap ap div 4 2   =   2
ap ap div 4 3   =   1
ap ap div 4 4   =   1
ap ap div 4 5   =   0
ap ap div 5 2   =   2
ap ap div 6 -2   =   -3
ap ap div 5 -3   =   -1
ap ap div -5 3   =   -1
ap ap div -5 -3   =   1
ap ap div x0 1   =   x0
...

Code

The Haskell code has been revised to decode the integer division operator.

diff --git a/source/annotate.hs b/source/annotate.hs
index 6a1e50e..21c4c11 100755
--- a/source/annotate.hs
+++ b/source/annotate.hs
@@ -273,6 +273,7 @@ symRepr (SymNumber val) = (show val, "green")
 symRepr (SymOperator val) = (t val, "yellow")
   where t 0 = "ap"
         t 12 = "="
+        t 40 = "div"
         t 146 = "mul"
         t 401 = "dec"
         t 417 = "inc"

Example output: