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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
(load "../common.tl")
(defstruct numbase nil
v
(:method + (me arg) ^(+ ,me.v ,arg))
(:method - (me arg) ^(- ,me.v ,arg))
(:method -- (me arg) ^(- ,arg ,me.v))
(:method neg (me) ^(- ,me.v))
(:method * (me arg) ^(* ,me.v ,arg))
(:method / (me arg) ^(/ ,me.v ,arg))
(:method // (me arg) ^(/ ,arg ,me.v))
(:method recip (me) ^(/ ,me.v))
(:method abs (me) ^(abs ,me.v))
(:method signum (me) ^(signum ,me.v))
(:method trunc (me arg) ^(trunc ,me.v ,arg))
(:method r-trunc (me arg) ^(trunc ,arg ,me.v))
(:method trunc1 (me) ^(trunc ,me.v))
(:method mod (me arg) ^(mod ,me.v ,arg))
(:method r-mod (me arg) ^(mod ,arg ,me.v))
(:method expt (me arg) ^(expt ,me.v ,arg))
(:method r-expt (me arg) ^(expt ,arg ,me.v))
(:method exptmod (me arg1 arg2) ^(exptmod ,me.v ,arg1 ,arg2))
(:method isqrt (me) ^(isqrt ,me.v))
(:method square (me) ^(square ,me.v))
(:method > (me arg) ^(> ,me.v ,arg))
(:method < (me arg) ^(< ,me.v ,arg))
(:method >= (me arg) ^(>= ,me.v ,arg))
(:method <= (me arg) ^(<= ,me.v ,arg))
(:method = (me arg) ^(= ,me.v ,arg))
(:method zerop (me) ^(zerop ,me.v))
(:method plusp (me) ^(plusp ,me.v))
(:method minusp (me) ^(minusp ,me.v))
(:method evenp (me) ^(evenp ,me.v))
(:method oddp (me) ^(oddp ,me.v))
(:method floor (me arg) ^(floor ,me.v ,arg))
(:method r-floor (me arg) ^(floor ,arg ,me.v))
(:method floor1 (me) ^(floor ,me.v))
(:method ceil (me arg) ^(ceil ,me.v ,arg))
(:method r-ceil (me arg) ^(ceil ,arg ,me.v))
(:method ceil1 (me) ^(ceil ,me.v))
(:method round (me arg) ^(round ,me.v ,arg))
(:method r-round (me arg) ^(round ,arg ,me.v))
(:method round1 (me) ^(round ,me.v))
(:method sin (me) ^(sin ,me.v))
(:method cos (me) ^(cos ,me.v))
(:method tan (me) ^(tan ,me.v))
(:method asin (me) ^(asin ,me.v))
(:method acos (me) ^(acos ,me.v))
(:method atan (me) ^(atan ,me.v))
(:method atan2 (me arg) ^(atan2 ,me.v ,arg))
(:method r-atan2 (me arg) ^(atan2 ,arg ,me.v))
(:method log (me) ^(log ,me.v))
(:method log2 (me) ^(log2 ,me.v))
(:method log10 (me) ^(log10 ,me.v))
(:method exp (me) ^(exp ,me.v))
(:method sqrt (me) ^(sqrt ,me.v))
(:method logand (me arg) ^(logand ,me.v ,arg))
(:method logior (me arg) ^(logior ,me.v ,arg))
(:method lognot (me arg) ^(lognot ,me.v ,arg))
(:method r-lognot (me arg) ^(lognot ,arg ,me.v))
(:method lognot1 (me) ^(lognot ,me.v))
(:method logtrunc (me arg) ^(logtrunc ,me.v ,arg))
(:method r-logtrunc (me arg) ^(logtrunc ,arg ,me.v))
(:method sign-extend (me arg) ^(sign-extend ,me.v ,arg))
(:method ash (me arg) ^(ash ,me.v ,arg))
(:method bit (me arg) ^(bit ,me.v ,arg))
(:method width (me) ^(width ,me.v))
(:method logcount (me) ^(logcount ,me.v))
(:method cbrt (me) ^(cbrt ,me.v))
(:method erf (me) ^(erf ,me.v))
(:method erfc (me) ^(erfc ,me.v))
(:method exp10 (me) ^(exp10 ,me.v))
(:method exp2 (me) ^(exp2 ,me.v))
(:method expm1 (me) ^(expm1 ,me.v))
(:method gamma (me) ^(gamma ,me.v))
(:method j0 (me) ^(j0 ,me.v))
(:method j1 (me) ^(j1 ,me.v))
(:method lgamma (me) ^(lgamma ,me.v))
(:method log1p (me) ^(log1p ,me.v))
(:method logb (me) ^(logb ,me.v))
(:method nearbyint (me) ^(nearbyint ,me.v))
(:method rint (me) ^(rint ,me.v))
(:method significand (me) ^(significand ,me.v))
(:method tgamma (me) ^(tgamma ,me.v))
(:method y0 (me) ^(y0 ,me.v))
(:method y1 (me) ^(y1 ,me.v))
(:method copysign (me arg) ^(copysign ,me.v ,arg))
(:method drem (me arg) ^(drem ,me.v ,arg))
(:method fdim (me arg) ^(fdim ,me.v ,arg))
(:method fmax (me arg) ^(fmax ,me.v ,arg))
(:method fmin (me arg) ^(fmin ,me.v ,arg))
(:method hypot (me arg) ^(hypot ,me.v ,arg))
(:method jn (me arg) ^(jn ,me.v ,arg))
(:method ldexp (me arg) ^(ldexp ,me.v ,arg))
(:method nextafter (me arg) ^(nextafter ,me.v ,arg))
(:method remainder (me arg) ^(remainder ,me.v ,arg))
(:method scalb (me arg) ^(scalb ,me.v ,arg))
(:method scalbln (me arg) ^(scalbln ,me.v ,arg))
(:method yn (me arg) ^(yn ,me.v ,arg))
(:method r-copysign (me arg) ^(copysign ,arg ,me.v))
(:method r-drem (me arg) ^(drem ,arg ,me.v))
(:method r-fdim (me arg) ^(fdim ,arg ,me.v))
(:method r-fmax (me arg) ^(fmax ,arg ,me.v))
(:method r-fmin (me arg) ^(fmin ,arg ,me.v))
(:method r-hypot (me arg) ^(hypot ,arg ,me.v))
(:method r-jn (me arg) ^(jn ,arg ,me.v))
(:method r-ldexp (me arg) ^(ldexp ,arg ,me.v))
(:method r-nextafter (me arg) ^(nextafter ,arg ,me.v))
(:method r-remainder (me arg) ^(remainder ,arg ,me.v))
(:method r-scalb (me arg) ^(scalb ,arg ,me.v))
(:method r-scalbln (me arg) ^(scalbln ,arg ,me.v))
(:method r-yn (me arg) ^(yn ,arg ,me.v))
(:method tofloat (me) ^(tofloat ,me.v))
(:method toint (me) ^(toint ,me.v)))
(defvarl n (new numbase v 1))
(test (+ n 0) (+ 1 0))
(test (+ 0 n) (+ 1 0))
(test (- n) (- 1))
(test (- n 0) (- 1 0))
(test (- 0 n) (- 0 1))
(test (* n 0) (* 1 0))
(test (* 0 n) (* 1 0))
(test (/ n 0) (/ 1 0))
(test (/ 0 n) (/ 0 1))
(test (/ n) (/ 1))
(test (abs n) (abs 1))
(test (signum n) (signum 1))
(test (trunc n 0) (trunc 1 0))
(test (trunc 0 n) (trunc 0 1))
(test (trunc n) (trunc 1))
(test (mod n 0) (mod 1 0))
(test (mod 0 n) (mod 0 1))
(test (expt n 0) (expt 1 0))
(test (expt 0 n) (expt 0 1))
(test (exptmod n 2 3) (exptmod 1 2 3))
(test (isqrt n) (isqrt 1))
(test (square n) (square 1))
(test (sys:b> n 0) (> 1 0))
(test (sys:b> 0 n) (< 1 0))
(test (sys:b< n 0) (< 1 0))
(test (sys:b< 0 n) (> 1 0))
(test (sys:b< 0 n) (> 1 0))
(test (sys:b= n 0) (= 1 0))
(test (sys:b= 0 n) (= 1 0))
(test (zerop n) (zerop 1))
(test (plusp n) (plusp 1))
(test (minusp n) (minusp 1))
(test (evenp n) (evenp 1))
(test (oddp n) (oddp 1))
(test (floor n 0) (floor 1 0))
(test (floor 0 n) (floor 0 1))
(test (floor n) (floor 1))
(test (ceil n 0) (ceil 1 0))
(test (ceil 0 n) (ceil 0 1))
(test (ceil n) (ceil 1))
(test (round n 0) (round 1 0))
(test (round 0 n) (round 0 1))
(test (round n) (round 1))
(test (sin n) (sin 1))
(test (cos n) (cos 1))
(test (tan n) (tan 1))
(test (asin n) (asin 1))
(test (acos n) (acos 1))
(test (atan n) (atan 1))
(test (atan2 n 0) (atan2 1 0))
(test (atan2 0 n) (atan2 0 1))
(test (log n) (log 1))
(test (log2 n) (log2 1))
(test (log10 n) (log10 1))
(test (exp n) (exp 1))
(test (sqrt n) (sqrt 1))
(test (logand n 0) (logand 1 0))
(test (logand 0 n) (logand 1 0))
(test (logior n 0) (logior 1 0))
(test (logior 0 n) (logior 1 0))
(test (lognot n 0) (lognot 1 0))
(test (lognot 0 n) (lognot 0 1))
(test (lognot n) (lognot 1))
(test (logtrunc n 0) (logtrunc 1 0))
(test (logtrunc 0 n) (logtrunc 0 1))
(test (sign-extend n 2) (sign-extend 1 2))
(test (ash n 0) (ash 1 0))
(test (width n) (width 1))
(test (logcount n) (logcount 1))
(test (cbrt n) (cbrt 1))
(test (erf n) (erf 1))
(test (erfc n) (erfc 1))
(test (exp10 n) (exp10 1))
(test (exp2 n) (exp2 1))
(test (expm1 n) (expm1 1))
(test (gamma n) (gamma 1))
(test (j0 n) (j0 1))
(test (j1 n) (j1 1))
(test (lgamma n) (lgamma 1))
(test (log1p n) (log1p 1))
(test (logb n) (logb 1))
(test (nearbyint n) (nearbyint 1))
(test (rint n) (rint 1))
(test (significand n) (significand 1))
(test (tgamma n) (tgamma 1))
(test (y0 n) (y0 1))
(test (y1 n) (y1 1))
(test (copysign n 0) (copysign 1 0))
(test (drem n 0) (drem 1 0))
(test (fdim n 0) (fdim 1 0))
(test (fmax n 0) (fmax 1 0))
(test (fmin n 0) (fmin 1 0))
(test (hypot n 0) (hypot 1 0))
(test (jn n 0) (jn 1 0))
(test (ldexp n 0) (ldexp 1 0))
(test (nextafter n 0) (nextafter 1 0))
(test (remainder n 0) (remainder 1 0))
(test (scalb n 0) (scalb 1 0))
(test (scalbln n 0) (scalbln 1 0))
(test (yn n 0) (yn 1 0))
(test (copysign 0 n) (copysign 0 1))
(test (drem 0 n) (drem 0 1))
(test (fdim 0 n) (fdim 0 1))
(test (fmax 0 n) (fmax 0 1))
(test (fmin 0 n) (fmin 0 1))
(test (hypot 0 n) (hypot 0 1))
(test (jn 0 n) (jn 0 1))
(test (ldexp 0 n) (ldexp 0 1))
(test (nextafter 0 n) (nextafter 0 1))
(test (remainder 0 n) (remainder 0 1))
(test (scalb 0 n) (scalb 0 1))
(test (scalbln 0 n) (scalbln 0 1))
(test (yn 0 n) (yn 0 1))
(test (tofloat n) (tofloat 1))
(test (toint n) (toint 1))
(test (arithp n) t)
|