aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/strap/RNS-.lsp
blob: 8888a7304f9cc4ab57f947337fe0f2c6b884d7f4 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
(/VERSIONCHECK 2) 

(DECLAIM (FTYPE (FUNCTION (|%Shell|) (|%IntegerSection| 0))
                |RNS-;characteristic;Nni;1|)) 

(PUT '|RNS-;characteristic;Nni;1| '|SPADreplace| '(XLAM NIL 0)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
                |RNS-;fractionPart;2S;2|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
                |RNS-;truncate;2S;3|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
                |RNS-;round;2S;4|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
                |RNS-;norm;2S;5|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
                |RNS-;coerce;FS;6|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
                |RNS-;convert;SP;7|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
                |RNS-;floor;2S;8|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
                |RNS-;ceiling;2S;9|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Thing| |%Shell|)
                    |%Thing|)
                |RNS-;patternMatch;SP2Pmr;10|)) 

(DEFUN |RNS-;characteristic;Nni;1| ($) (DECLARE (IGNORE $)) 0) 

(DEFUN |RNS-;fractionPart;2S;2| (|x| $)
  (SPADCALL |x| (SPADCALL |x| (|shellEntry| $ 10)) (|shellEntry| $ 11))) 

(DEFUN |RNS-;truncate;2S;3| (|x| $)
  (COND
    ((SPADCALL |x| (|shellEntry| $ 14))
     (SPADCALL
         (SPADCALL (SPADCALL |x| (|shellEntry| $ 15))
             (|shellEntry| $ 16))
         (|shellEntry| $ 15)))
    (T (SPADCALL |x| (|shellEntry| $ 16))))) 

(DEFUN |RNS-;round;2S;4| (|x| $)
  (COND
    ((SPADCALL |x| (|shellEntry| $ 14))
     (SPADCALL
         (SPADCALL |x|
             (SPADCALL (|spadConstant| $ 18)
                 (SPADCALL 2 (|shellEntry| $ 20)) (|shellEntry| $ 21))
             (|shellEntry| $ 11))
         (|shellEntry| $ 10)))
    (T (SPADCALL
           (SPADCALL |x|
               (SPADCALL (|spadConstant| $ 18)
                   (SPADCALL 2 (|shellEntry| $ 20))
                   (|shellEntry| $ 21))
               (|shellEntry| $ 24))
           (|shellEntry| $ 10))))) 

(DEFUN |RNS-;norm;2S;5| (|x| $) (SPADCALL |x| (|shellEntry| $ 26))) 

(DEFUN |RNS-;coerce;FS;6| (|x| $)
  (SPADCALL
      (SPADCALL (SPADCALL |x| (|shellEntry| $ 29)) (|shellEntry| $ 20))
      (SPADCALL (SPADCALL |x| (|shellEntry| $ 30)) (|shellEntry| $ 20))
      (|shellEntry| $ 21))) 

(DEFUN |RNS-;convert;SP;7| (|x| $)
  (SPADCALL (SPADCALL |x| (|shellEntry| $ 33)) (|shellEntry| $ 35))) 

(DEFUN |RNS-;floor;2S;8| (|x| $)
  (LET ((|x1| (SPADCALL (SPADCALL |x| (|shellEntry| $ 37))
                  (|shellEntry| $ 20))))
    (COND
      ((SPADCALL |x| |x1| (|shellEntry| $ 38)) |x|)
      ((SPADCALL |x| (|spadConstant| $ 39) (|shellEntry| $ 41))
       (SPADCALL |x1| (|spadConstant| $ 18) (|shellEntry| $ 11)))
      (T |x1|)))) 

(DEFUN |RNS-;ceiling;2S;9| (|x| $)
  (LET ((|x1| (SPADCALL (SPADCALL |x| (|shellEntry| $ 37))
                  (|shellEntry| $ 20))))
    (COND
      ((SPADCALL |x| |x1| (|shellEntry| $ 38)) |x|)
      ((SPADCALL |x| (|spadConstant| $ 39) (|shellEntry| $ 44))
       (SPADCALL |x1| (|spadConstant| $ 18) (|shellEntry| $ 24)))
      (T |x1|)))) 

(DEFUN |RNS-;patternMatch;SP2Pmr;10| (|x| |p| |l| $)
  (COND
    ((SPADCALL |p| (|shellEntry| $ 46))
     (SPADCALL |p| |x| |l| (|shellEntry| $ 48)))
    ((SPADCALL |p| (|shellEntry| $ 49))
     (LET ((|r| (SPADCALL |p| (|shellEntry| $ 51))))
       (COND
         ((ZEROP (CAR |r|))
          (COND
            ((SPADCALL (SPADCALL |x| (|shellEntry| $ 33)) (CDR |r|)
                 (|shellEntry| $ 52))
             |l|)
            (T (SPADCALL (|shellEntry| $ 53)))))
         (T (SPADCALL (|shellEntry| $ 53))))))
    (T (SPADCALL (|shellEntry| $ 53))))) 

(DEFUN |RealNumberSystem&| (|#1|)
  (LET* ((|dv$1| (|devaluate| |#1|))
         (|dv$| (LIST '|RealNumberSystem&| |dv$1|)) ($ (|newShell| 58))
         (|pv$| (|buildPredVector| 0 0 NIL)))
    (SETF (|shellEntry| $ 0) |dv$|)
    (SETF (|shellEntry| $ 3) |pv$|)
    (|stuffDomainSlots| $)
    (SETF (|shellEntry| $ 6) |#1|)
    $)) 

(MAKEPROP '|RealNumberSystem&| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|)
             (|NonNegativeInteger|) (0 . |Zero|)
             |RNS-;characteristic;Nni;1| (4 . |truncate|) (9 . -)
             |RNS-;fractionPart;2S;2| (|Boolean|) (15 . |negative?|)
             (20 . -) (25 . |floor|) |RNS-;truncate;2S;3| (30 . |One|)
             (|Integer|) (34 . |coerce|) (39 . /) (|PositiveInteger|)
             (45 . |One|) (49 . +) |RNS-;round;2S;4| (55 . |abs|)
             |RNS-;norm;2S;5| (|Fraction| 19) (60 . |numer|)
             (65 . |denom|) |RNS-;coerce;FS;6| (|Float|)
             (70 . |convert|) (|Pattern| 32) (75 . |coerce|)
             |RNS-;convert;SP;7| (80 . |wholePart|) (85 . =)
             (91 . |Zero|) (95 . |Zero|) (99 . <) (105 . |One|)
             |RNS-;floor;2S;8| (109 . >=) |RNS-;ceiling;2S;9|
             (115 . |generic?|) (|PatternMatchResult| 32 6)
             (120 . |addMatch|) (127 . |constant?|)
             (|Union| 32 '"failed") (132 . |retractIfCan|) (137 . =)
             (143 . |failed|) (|PatternMatchResult| 32 $)
             |RNS-;patternMatch;SP2Pmr;10| (|DoubleFloat|)
             (|OutputForm|))
          '#(|truncate| 147 |round| 152 |patternMatch| 157 |norm| 164
             |fractionPart| 169 |floor| 174 |convert| 179 |coerce| 184
             |characteristic| 194 |ceiling| 198)
          'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 55
                                '(0 7 0 8 1 6 0 0 10 2 6 0 0 0 11 1 6
                                  13 0 14 1 6 0 0 15 1 6 0 0 16 0 6 0
                                  18 1 6 0 19 20 2 6 0 0 0 21 0 22 0 23
                                  2 6 0 0 0 24 1 6 0 0 26 1 28 19 0 29
                                  1 28 19 0 30 1 6 32 0 33 1 34 0 32 35
                                  1 6 19 0 37 2 6 13 0 0 38 0 6 0 39 0
                                  19 0 40 2 6 13 0 0 41 0 19 0 42 2 6
                                  13 0 0 44 1 34 13 0 46 3 47 0 34 6 0
                                  48 1 34 13 0 49 1 34 50 0 51 2 32 13
                                  0 0 52 0 47 0 53 1 0 0 0 17 1 0 0 0
                                  25 3 0 54 0 34 54 55 1 0 0 0 27 1 0 0
                                  0 12 1 0 0 0 43 1 0 34 0 36 1 0 0 28
                                  31 1 0 0 28 31 0 0 7 9 1 0 0 0 45)))))
          '|lookupComplete|))