Sha256: 96bb3bd0ef542f615c1d8bc43c69f0a30e0eece946c4a2f552f112dd09a34330

Contents?: true

Size: 826 Bytes

Versions: 10

Compression:

Stored size: 826 Bytes

Contents

[[File:PietArithmaticInteger.png]]<br>
 <code>
 command   stack
 in(int)   A
 duplicate AA
 duplicate AAA
 duplicate AAAA
 duplicate AAAAA
 in(int)   BAAAAA
 duplicate BBAAAAA
 duplicate BBBAAAAA
 duplicate BBBBAAAAA
 duplicate BBBBBAAAAA
 push 9    9BBBBBAAAAA
 push 1    19BBBBBAAAAA
 roll      BBBBAAAABA
 push 7    7BBBBAAAABA
 push 1    17BBBBAAAABA
 roll      BBBAAABABA
 push 5    5BBBAAABABA
 push 1    15BBBAAABABA
 roll      BBAABABABA
 push 3    3BBAABABABA
 push 1    13BBAABABABA
 roll      BABABABABA
 add       (A+B)BABABABA
 out(int)  BABABABA
 sub       (A-B)BABABA
 out(int)  BABABA
 mult      (A*B)BABA
 out(int)  BABA
 divide    (A/B)BA
 out(int)  BA
 mod       (A%B)
 out(int)  NULL
 push 1    1
 exit</code>
How rounding is handled is up to the interpreter, but I believe the intent was round towards 0.

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/arithmetic.integer/piet.txt
zettacode-0.1.6 files.zettacode/arithmetic.integer/piet.txt
zettacode-0.1.6 files.zettacode2/arithmetic.integer/piet.txt
zettacode-0.1.5 files.zettacode/arithmetic.integer/piet.txt
zettacode-0.1.5 files.zettacode2/arithmetic.integer/piet.txt
zettacode-0.1.4 files.zettacode/arithmetic.integer/piet.txt
zettacode-0.1.4 files.zettacode2/arithmetic.integer/piet.txt
zettacode-0.1.3 files.zettacode/arithmetic.integer/piet.txt
zettacode-0.1.2 files.zettacode/arithmetic.integer/piet.txt
zettacode-0.1.1 zettacode.files/arithmetic.integer/piet.txt