comparison interps/c-intercal/pit/lib/syslib3-7.doc @ 996:859f9b4339e6

<Gregor> tar xf egobot.tar.xz
author HackBot
date Sun, 09 Dec 2012 19:30:08 +0000
parents
children
comparison
equal deleted inserted replaced
995:6883f5911eb7 996:859f9b4339e6
1 Although the non-binary libraries syslib.[3-7]i are meant to be
2 treated as workalikes with the original system library, it should be
3 noted that several of them contain some new routines. These are used
4 internally by the standard routines, and are there to provide methods
5 for doing a few things that are taken for granted in base 2. While
6 they were not intended to be used by other programs, there is nothing
7 stopping them from being so used.
8
9 The even bases have routines to double and halve values, and use a
10 third variable as a carry/borrow flag. Since halving in odd bases
11 produces infinite fractions, bases 5 and 7 instead use a single-digit
12 multiplication routine. (Base 3 multiplication is still simple enough
13 to be handled without a separate support routine.)
14
15 syslib.4i
16 ---------
17 (1200) .2 <- .1 times two
18 .3 <- #0 if no overflow, otherwise .3 contains the quart that
19 was "shifted" off the left end
20 (1210) .2 <- .1 divided by two
21 .3 <- #0 if .1 is even, otherwise .3 contains #2
22 (1700) :2 <- :1 times two
23 .1 <- #0 if no overflow, otherwise .1 contains the quart that
24 was "shifted" off the left end
25 (1710) :2 <- :1 divided by two
26 .1 <- #0 if .1 is even, otherwise .1 contains #2
27
28 syslib.5i
29 ---------
30 (1720) :2 <- :1 times the least significant quint of .1 (the remaining
31 quints of .1 are ignored)
32 .2 <- #0 if no overflow, otherwise .2 contains the quint that
33 was "shifted" off the left end
34
35 syslib.6i
36 ---------
37 (1200) .2 <- .1 times two
38 .3 <- #0 if no overflow, otherwise .3 contains the sext that
39 was "shifted" off the left end
40 (1210) .2 <- .1 divided by two
41 .3 <- #0 if .1 is even, otherwise .3 contains #3
42 (1700) :2 <- :1 times two
43 .1 <- #0 if no overflow, otherwise .1 contains the sext that
44 was "shifted" off the left end
45 (1710) :2 <- :1 divided by two
46 .1 <- #0 if .1 is even, otherwise .1 contains #3
47
48 syslib.7i
49 ---------
50 (1720) :2 <- :1 times the least significant sept of .1 (the remaining
51 septs of .1 are ignored)
52 .2 <- #0 if no overflow, otherwise .2 contains the sept that
53 was "shifted" off the left end