~ubuntu-branches/ubuntu/lucid/x11-apps/lucid

« back to all changes in this revision

Viewing changes to xedit/lisp/test/math.lsp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2008-09-23 00:24:45 UTC
  • mfrom: (1.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080923002445-mb2rwkif45zz1vlj
Tags: 7.3+4
* Remove xedit from the package, it's unmaintained and broken
  (closes: #321434).
* Remove xedit's conffiles on upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
;;
2
 
;; Copyright (c) 2002 by The XFree86 Project, Inc.
3
 
;;
4
 
;; Permission is hereby granted, free of charge, to any person obtaining a
5
 
;; copy of this software and associated documentation files (the "Software"),
6
 
;; to deal in the Software without restriction, including without limitation
7
 
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
 
;; and/or sell copies of the Software, and to permit persons to whom the
9
 
;; Software is furnished to do so, subject to the following conditions:
10
 
;;
11
 
;; The above copyright notice and this permission notice shall be included in
12
 
;; all copies or substantial portions of the Software.
13
 
;;
14
 
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
 
;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
 
;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17
 
;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18
 
;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19
 
;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
 
;; SOFTWARE.
21
 
;;
22
 
;; Except as contained in this notice, the name of the XFree86 Project shall
23
 
;; not be used in advertising or otherwise to promote the sale, use or other
24
 
;; dealings in this Software without prior written authorization from the
25
 
;; XFree86 Project.
26
 
;;
27
 
;; Author: Paulo César Pereira de Andrade
28
 
;;
29
 
;;
30
 
;; $XFree86: xc/programs/xedit/lisp/test/math.lsp,v 1.4 2002/11/30 23:13:14 paulo Exp $
31
 
;;
32
 
 
33
 
;; basic math tests
34
 
;; This is far from a good regression test, but in the current stage of
35
 
;; the interpreter, this is good enough to make sure it is not "so"
36
 
;; broken. But note that this does not test all cases where there is
37
 
;; change in the type of a numeric object.
38
 
 
39
 
(setq *default-float-format* 'double-float)
40
 
 
41
 
;; floating point results may differ from implementation to implementation (?!)
42
 
 
43
 
(defun test (expect function &rest arguments &aux result (error t))
44
 
    (ignore-errors
45
 
        (setq result (apply function arguments))
46
 
        (setq error nil)
47
 
    )
48
 
    (if error
49
 
        (format t "ERROR: (~A~{ ~A~})~%" function arguments)
50
 
        ;; Use eql to make sure result and expect have the same type
51
 
        (or (eql result expect)
52
 
#-xedit ;; hack...
53
 
            (or
54
 
                (and
55
 
                    (floatp result)
56
 
                    (floatp expect)
57
 
                    (< (abs (- (abs result) (abs expect)))
58
 
                        0.00000000000001d0)
59
 
                )
60
 
                (format t "(~A~{ ~A~}) => should be ~A not ~A~%"
61
 
                    function arguments expect result
62
 
                )
63
 
            )
64
 
#+xedit     (format t "(~A~{ ~A~}) => should be ~A not ~A~%"
65
 
                function arguments expect result
66
 
            )
67
 
        )
68
 
    )
69
 
)
70
 
 
71
 
(defun div-test (quotient remainder function &rest arguments
72
 
                 &aux quo rem  (error t))
73
 
    (ignore-errors
74
 
        (multiple-value-setq (quo rem) (apply function arguments))
75
 
        (setq error nil)
76
 
    )
77
 
    (if error
78
 
        (format t "ERROR: (~A~{ ~A~})~%" function arguments)
79
 
        (or (and (eql quotient quo) (eql remainder rem))
80
 
#-xedit ;; hack
81
 
            (or
82
 
                (or
83
 
                    (eql quotient quo)
84
 
                    (and
85
 
                        (floatp quotient)
86
 
                        (floatp quo)
87
 
                        (< (abs (- (abs quotient) (abs quo)))
88
 
                            0.00000000000001d0)
89
 
                    )
90
 
                )
91
 
                (or
92
 
                    (eql remainder rem)
93
 
                    (and
94
 
                        (floatp remainder)
95
 
                        (floatp rem)
96
 
                        (< (abs (- (abs remainder) (abs rem)))
97
 
                            0.00000000000001d0)
98
 
                    )
99
 
                )
100
 
                (format t "(~A~{ ~A~}) => should be ~A; ~A not ~A; ~A~%"
101
 
                    function arguments quotient remainder quo rem
102
 
                )
103
 
            )
104
 
#+xedit     (format t "(~A~{ ~A~}) => should be ~A; ~A not ~A; ~A~%"
105
 
                function arguments quotient remainder quo rem
106
 
            )
107
 
        )
108
 
    )
109
 
)
110
 
 
111
 
(defun bool-test (expect function &rest arguments &aux result (error t))
112
 
    (ignore-errors
113
 
        (setq result (apply function arguments))
114
 
        (setq error nil)
115
 
    )
116
 
    (if error
117
 
        (format t "ERROR: (~A~{ ~A~})~%" function arguments)
118
 
        (or (eq result expect)
119
 
            (format t "(~A~{ ~A~}) => should be ~A not ~A~%"
120
 
                function arguments expect result
121
 
            )
122
 
        )
123
 
    )
124
 
)
125
 
 
126
 
(defun error-test (function &rest arguments &aux result (error t))
127
 
  (ignore-errors
128
 
    (setq result (apply function arguments))
129
 
    (setq error nil))
130
 
  (unless error
131
 
    (format t "ERROR: no error for (~A~{ ~A}), result was ~A~%"
132
 
      function arguments result)))
133
 
 
134
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
135
 
;; fixnum fixnum
136
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
137
 
(test 0 #'+)
138
 
(test 5 #'+ 5)
139
 
(test -2 #'+ -2)
140
 
(test 3 #'+ 2 1)
141
 
(test 134217728 #'+ 134217727 1)
142
 
(test -134217729 #'+ -134217728 -1)
143
 
(test 2147483648 #'+ 2147483647 1)
144
 
(test -2147483649 #'+ -2147483648 -1)
145
 
(test -5 #'- 5)
146
 
(test 6 #'- -6)
147
 
(test 1 #'- 2 1)
148
 
(test 134217728 #'- 134217727 -1)
149
 
(test -2147483649 #'- -2147483648 1)
150
 
(test 4294967295 #'- 2147483647 -2147483648)
151
 
(test 1 #'*)
152
 
(test 4 #'* 4)
153
 
(test -5 #'* -5)
154
 
(test 6 #'* 2 3)
155
 
(test 2147483648 #'* 65536 32768)
156
 
(test 2147418112 #'* 65536 32767)
157
 
(test 134217728 #'* 65536 2048)
158
 
(test -134217728 #'* 65536 -2048)
159
 
(test 1/3 #'/ 3)
160
 
(test -1/4 #'/ -4)
161
 
(test 1/3 #'/ 10 30)
162
 
(test -1/2 #'/ -5 10)
163
 
(test -4 #'/ 20 -5)
164
 
(test 431432412345/32 #'/ 431432412345 32)
165
 
(test -2147483647/2147483648 #'/ 2147483647 -2147483648)
166
 
(test -1 #'/ 2147483648 -2147483648)
167
 
(test 2147483648 #'/ -2147483648 -1)
168
 
(test -1/2147483648 #'/ 1 -2147483648)
169
 
(test 1 #'min 2 3 4 1 5)
170
 
(test 7 #'max 0 -2 7 6 3)
171
 
(test -2147483648 #'min -2147483648 2147483647)
172
 
(test 2147483647 #'max -2147483648 2147483647)
173
 
(bool-test t #'< 1 2)
174
 
(bool-test nil #'< 2 2)
175
 
(bool-test nil #'< 4 3)
176
 
(bool-test t #'< -2147483648 -1)
177
 
(bool-test t #'< -2147483648 2147483648)
178
 
(bool-test t #'<= 3 3)
179
 
(bool-test nil #'<= 3 2)
180
 
(bool-test t #'<= 3 7)
181
 
(bool-test t #'<= -2147483648 2147483648)
182
 
(bool-test t #'= 1 1)
183
 
(bool-test nil #'= 1 -1)
184
 
(bool-test t #'= -2147483648 -2147483648)
185
 
(bool-test t #'>= 4 3)
186
 
(bool-test t #'>= 5 5)
187
 
(bool-test nil #'>= 4 9)
188
 
(bool-test t #'>= 2147483647 -2147483648)
189
 
(bool-test t #'> 7 5)
190
 
(bool-test nil #'> 20 20)
191
 
(bool-test nil #'> 19 31)
192
 
(bool-test nil #'> 2147483647 2147483648)
193
 
(bool-test nil #'> -2147483648 2147483647)
194
 
(bool-test nil #'/= 2147483647 2147483647)
195
 
(bool-test t #'/= 2147483647 -2147483648)
196
 
 
197
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
198
 
;; fixnum bignum
199
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
200
 
(test 4123412341238575768576858308380 #'+
201
 
        431412 4123412341238575768576857876968)
202
 
(test -653653534554686349560628211 #'-
203
 
        4231423 653653534554686349564859634)
204
 
(test 17952112630025927929 #'* 4342423 4134123421423)
205
 
(test 412341/766687896595678 #'/ 412341 766687896595678)
206
 
 
207
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
208
 
;; fixnum flonum
209
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
210
 
(test 566594.4123d0 #'+ 43141 523453.4123d0)
211
 
(test -2.106249523586876d9 #'+ -2147483647 41234123.413124d0)
212
 
(test -6530250.653d0 #'- 4314 6534564.653d0)
213
 
(test -358687.653d0 #'- -324123 34564.653d0)
214
 
(test 3.26338916904d67 #'* 431234 756756d56)
215
 
(test 5.731169192902366d-50 #'/ 3 5234534d43)
216
 
(bool-test t #'< 423421 646454d0)
217
 
(bool-test t #'= 43242113 43242113d0)
218
 
 
219
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
220
 
;; fixnum fixratio
221
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
222
 
(test 38654705646/17 #'+ 2147483647 2147483647/17)
223
 
(test -2146748499/17 #'+ 43244 -2147483647/17)
224
 
(test 17633127/4232 #'- 4321 653345/4232)
225
 
(test 28227714415090/4323 #'* 4312442 6545645/4323)
226
 
(test 639030/1441 #'* 42 15215/1441)
227
 
(test 924444112/547 #'/ 3432342 1641/808)
228
 
(bool-test t #'> 41342 42423/32)
229
 
 
230
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
231
 
;; fixnum bigratio
232
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
233
 
(test 134681902103055335/31231131234 #'+ 4312423 53453535353/31231131234)
234
 
(test 134681795195984629/31231131234 #'- 4312423 53453535353/31231131234)
235
 
(test 230514255287590319/31231131234 #'* 4312423 53453535353/31231131234)
236
 
(test 134681848649519982/53453535353 #'/ 4312423 53453535353/31231131234)
237
 
(bool-test t #'> 4312423 53453535353/31231131234)
238
 
 
239
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
240
 
;; bignum fixnum
241
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
242
 
(test 4123412341234124068 #'+ 4123412341234123412 656)
243
 
(test 2147483647 #'+ 2147483648 -1)
244
 
(test 2147483648 #'- 2147483647 -1)
245
 
(test 3245393337480 #'* 4242344232 765)
246
 
(test 1414114744/255 #'/ 4242344232 765)
247
 
(bool-test nil #'< 2147483648 1)
248
 
(bool-test t #'> 2147483648 -2147483648)
249
 
 
250
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
251
 
;; bignum flonum
252
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
253
 
(test 5.452523543454353d15 #'+ 5452523543454353 423d-6)
254
 
(test -3.41423d205 #'- 54235423452345424443423 341423d200)
255
 
(test 2.7061221650759596d89 #'* 413423412341231232 6.545643242d71)
256
 
(test 9.744908405310087d-29 #'/ 41341234214 4242342d32)
257
 
(bool-test t #'< 4314123412312341234123 4234242d46)
258
 
(bool-test nil #'> 42342342142142421412341242 423423.432423d51)
259
 
(bool-test t #'= 100000000000000000000 1d20)
260
 
 
261
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
262
 
;; bignum fixratio
263
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
264
 
(test 3027180466416641662/7 #'+ 432454352345234523 1/7)
265
 
(test 4294967295/2 #'- 2147483648 1/2)
266
 
(test 14113747078041141/152263 #'* 42341241234123423 1/456789)
267
 
(test 475355357536664/19 #'* 43214123412424 11/19)
268
 
(test 143960192608 #'/ 4234123312 1/34)
269
 
(test 15032385536/5 #'/ 2147483648 5/7)
270
 
(bool-test nil #'< 4123412341234123 423424/23)
271
 
(bool-test nil #'= 2147483648 1/3)
272
 
(bool-test t #'> 2147483648 1/3)
273
 
 
274
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
275
 
;; bignum bigratio
276
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
277
 
(test -493153721444554600746963362777609/11404707804137
278
 
        #'+ -43241241241241234234 18178448448449/11404707804137)
279
 
(test 22573725350444837506376255369215081106984960/431241324242143434377
280
 
        #'- 52345923457394857234895 455/431241324242143434377)
281
 
(test 355905909219316970540364021939287762325439304380984344811607132990/14374707710807
282
 
        #'* 45523452345234790345923405723902389345782390 23454234524234523623623/43124123132421)
283
 
(test -853356237922877963618542794532291751029677352/21566206170617061706171
284
 
        #'/ 4131234123412342 -43132412341234123412342/413124123412312234123412312312)
285
 
(bool-test nil #'< 9482384762389461234892 463124869123897/43124123456678)
286
 
(bool-test t #'/= 4689123469123846123843 4123894623894612/211)
287
 
(bool-test t #'> 90437849234701234891203 4234123423/37)
288
 
 
289
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
290
 
;; flonum fixnum
291
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
292
 
(test 4.3291328479d86 #'+ 43291328479d76 431243)
293
 
(test 4.123123123432d58 #'- 4123123123432d46 2147483647)
294
 
(test 4.1974800714094d109 #'* 970874791d96 43234)
295
 
(test -1.0004838618250252d55 #'/ -432423.432d56 4322143)
296
 
(bool-test nil #'< 4324932.342d5 4321421)
297
 
(bool-test t #'> 2147483648d0 2147483647)
298
 
 
299
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
300
 
;; flonum bignum
301
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
302
 
(test 4.3124325345d62 #'+ 4312432.5345d56 431241234901234791023479023)
303
 
(test 4.123123443242d39 #'- 41231234.43242d32 -10947390284720389)
304
 
(test 9.81681448753991d48 #'* 42342.89d27 231840917980324712)
305
 
(test 6.837110051466236d49 #'/ -64832d57 -948236894126)
306
 
(bool-test nil #'< 7589079203d56 43214124124312)
307
 
 
308
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
309
 
;; flonum flonum
310
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
311
 
(test 4.12685643412d7 #'+ 34442.3412d0 41234122d0)
312
 
(test -4.23432d84 #'- -45523453d56 423432d79)
313
 
(test 2.0000000000000004d0 #'* 1.4142135623730951d0 1.4142135623730951d0)
314
 
(test -1.414213562373095d0 #'/ -2d0 1.4142135623730951d0)
315
 
(test 0.7071067811865476d0 #'/ 1.4142135623730951d0 2d0)
316
 
(bool-test nil #'< 43124123d56 4231412d43)
317
 
 
318
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
319
 
;; flonum fixratio
320
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
321
 
(test 3.41412d61 #'+ 341412d56 3/652)
322
 
(test 4.312443d72 #'- 43124.43d68 42421/5678)
323
 
(test -4.32112300201218d73 #'* 4321123d67 -2147483648/2147483647)
324
 
(test 3.388443859138533d58 #'/ 432412d54 13744/1077)
325
 
(bool-test t #'> 423194237d43 4231412/23)
326
 
 
327
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
328
 
;; flonum bigratio
329
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
330
 
(test 4.378904431d62 #'+ 4378904.431d56 49230471923047129/32412341234126)
331
 
(test 0d0 #'- 1.7320508075688772d0 3900231685776981/2251799813685248)
332
 
(test 5.000000000000001d0 #'* 2.23606797749979d0 629397181890197/281474976710656)
333
 
(test 7.000000000000001d0 #'/ 2.6457513110645907d0 1125899906842624/2978851154656373)
334
 
(bool-test nil #'< 790412390412d45 1005712007432/10518078881)
335
 
 
336
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
337
 
;; fixratio fixnum
338
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
339
 
(test 23502480199/57 #'+ 1/57 412324214)
340
 
(test -1608505/39 #'- 11/39 41244) 
341
 
(test 241844976595/3121 #'* 45245/3121 5345231)
342
 
(test 4231/30211050 #'/ 4231/67890 445)
343
 
(bool-test nil #'< 43123/12 -3432)
344
 
 
345
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
346
 
;; fixratio bignum
347
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
348
 
(test 290071443963580821646/4115 #'+ -14119/4115 70491237901234711)
349
 
(test 92654360215843653827434431256/1237 #'- 423412/1237 -74902473901247901234789012)
350
 
(test 139081825032265225396/111 #'* 13/777 74890213478912044444)
351
 
(test -22/19000187487170108051697772680759 #'/ -176/31 4903274190237447239147812304712)
352
 
(bool-test t #'< 7094123/312 423412429047)
353
 
 
354
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
355
 
;; fixratio flonum
356
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
357
 
(test 3756.777956289953d0 #'+ 41290/11 3.141592653589793d0)
358
 
(test 3750.494770982774d0 #'- 41290/11 3.141592653589793d0)
359
 
(test 11792.396424247505d0 #'* 41290/11 3.141592653589793d0)
360
 
(test 1194.8195636844289d0 #'/ 41290/11 3.141592653589793d0)
361
 
(bool-test nil #'< 41290/11 3.141592653589793d0)
362
 
 
363
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
364
 
;; fixratio fixratio
365
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
366
 
(test -2/2147483647 #'+ 2147483646/2147483647 -2147483648/2147483647)
367
 
(test 4611686015206162432/2305843005992468481 #'+ 2147483648/2147483646 2147483648/2147483647)
368
 
(test 114/91 #'+ 5/7 7/13)
369
 
(test 2 #'- 2147483646/2147483647 -2147483648/2147483647)
370
 
(test -6442450939/4611686009837453315 #'- 2147483646/2147483647 2147483647/2147483645)
371
 
(test 214/231 #'- 5/7 -7/33)
372
 
(test 183092240452/408559 #'* '432421/3217 423412/127)
373
 
(test 1057751/7345 #'* 34121/65 31/113)
374
 
(test -93866791/102381559 #'/ 143747/107 -956837/653)
375
 
(test 117/517 #'/ 13/33 47/27)
376
 
(bool-test nil #'< 5/3 7/9)
377
 
 
378
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
379
 
;; fixratio bigratio
380
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
381
 
(test 1211321073398067249731082729214954013/1099249926163926018396018404101914
382
 
        #'+ 23141/21 572903572390457239/52345234579234572304572304957234)
383
 
(test -1210401943424090457832980748892408320175/1099249926163926018396018404101914
384
 
        #'+ -23123441/21 572903572390457239/52345234579234572304572304957234)
385
 
(test -130565585970579643613431728982140/1297324236427391
386
 
        #'- 6/83 1573079349043128237436315709694/15630412487077)
387
 
(test 119377824848653/98027 #'* 4123/61 28954117111/1607)
388
 
(test -533081148/1126543487854337661125 #'/ 4132412/125 -9012347902834701289/129)
389
 
(bool-test nil #'< 4132412/125 -9012347902834701289/129)
390
 
 
391
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
392
 
;; bigratio fixnum
393
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
394
 
(test 48668779872364438/8438103123 #'+ 49032749012471920/8438103123 -43134)
395
 
(test 49396718152579402/8438103123 #'- 49032749012471920/8438103123 -43134)
396
 
(test -704992865301321265760/2812701041 #'* 49032749012471920/8438103123 -43134)
397
 
(test -24516374506235960/181984570053741 #'/ 49032749012471920/8438103123 -43134)
398
 
(bool-test t #'> 49032749012471920/8438103123 -43134)
399
 
 
400
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
401
 
;; bigratio bignum
402
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
403
 
(test 22765322736543569109219273030163417097453878379283263605274270/46382946123894712341
404
 
        #'+ 4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912)
405
 
(test -22765322736543569109219273030163417097453878379283263605274270/46382946123894712341
406
 
        #'- -4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912)
407
 
(test -2303047849571666696101160700266058250647016644840659232609643130849536/46382946123894712341
408
 
        #'* 4692318468912374612389461278/46382946123894712341 -490812348912346238794612389461238961238912)
409
 
(test 2346159234456187306194730639/11382661368271784554609636515081706202567704733454325607906496
410
 
        #'/ -4692318468912374612389461278/46382946123894712341 -490812348912346238794612389461238961238912)
411
 
(bool-test t #'< 4692318468912374612389461278/46382946123894712341 490812348912346238794612389461238961238912)
412
 
 
413
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
414
 
;; bigratio flonum
415
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
416
 
(test 63.2771680782255d0 #'+ 31.63858403911275d0 4452734852783697/140737488355328)
417
 
(test 0d0 #'+ -31.63858403911275d0 4452734852783697/140737488355328)
418
 
(test -1001.0000000000001d0 #'* -31.63858403911275d0 4452734852783697/140737488355328)
419
 
(test 1d0 #'/ -31.63858403911275d0 -4452734852783697/140737488355328)
420
 
(bool-test nil #'< -31.63858403911275d0 -4452734852783697/140737488355328)
421
 
(bool-test nil #'> -31.63858403911275d0 -4452734852783697/140737488355328)
422
 
(bool-test nil #'/= -31.63858403911275d0 -4452734852783697/140737488355328)
423
 
 
424
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
425
 
;; bigratio fixratio
426
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
427
 
(test 0 #'+ 2147483648/2147483647 -2147483648/2147483647)
428
 
(test 3230093924913437/413416372043776 #'+ 45705840067699/8796093022208 123/47)
429
 
(test 4294967296/2147483647 #'- 2147483648/2147483647 -2147483648/2147483647)
430
 
(test 1066255041450269/413416372043776 #'- 45705840067699/8796093022208 123/47)
431
 
(test -5621818328326977/413416372043776 #'* -45705840067699/8796093022208 123/47)
432
 
(test -2148174483181853/1081919441731584 #'/ 45705840067699/8796093022208 -123/47)
433
 
(bool-test t #'> 45705840067699/8796093022208 123/47)
434
 
 
435
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
436
 
;; bigratio bigratio
437
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
438
 
(test 2679495973598190955776211861634126560767052764822779809414184089582/140710542183009389719255843429922029722593
439
 
        #'+ 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891)
440
 
(test 2679495973598190955776211861634126560767052765333892522296541398514/140710542183009389719255843429922029722593
441
 
        #'- 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891)
442
 
(test -4866460021317766216371472892133283923086494176/140710542183009389719255843429922029722593
443
 
        #'* 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891)
444
 
(test -1339747986799095477888105930817063280383526382539168082927681372024/127778178220589327233
445
 
        #'/ 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891)
446
 
(bool-test t #'> 649812364891236481923461238946128/34124123 -7489023423142/4123491823746192384761238946123891)
447
 
 
448
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
449
 
;; complex real
450
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
451
 
(test #c(2147483648 -1) #'+ #c(1 -1) 2147483647)
452
 
(test #c(2.147483648d9 -1) #'+ #c(2147483647 -1) 1d0)
453
 
(test #c(129642370237029633787/3 0.25d0) #'- #c(-11/3 0.25d0) -43214123412343211266)
454
 
(test #c(23470/21 4.333333333333334d0) #'* #c(2347/7 1.3d0) 10/3)
455
 
(test #c(134217728/11 67108864/11) #'* #c(65536 32768) 2048/11)
456
 
(test #c(1.3133333333333332d0 82304) #'/ #c(1.97d0 123456) 3/2)
457
 
 
458
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
459
 
;; real complex
460
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
461
 
(test #c(80/7 7/13) #'+ 3/7 #c(11 7/13))
462
 
(test #c(1.2345d47 -1) #'+ 12345d43 #c(-2147483648 -1))
463
 
(test #c(-2147483649 2147483647) #'+ -2147483648 #c(-1 2147483647))
464
 
(test #c(41/15 1.23456d68) #'- #c(7/5 1234.56d65) -4/3)
465
 
(test #c(-41/19 2147483648) #'* #c(41/19 -2147483648) -1)
466
 
(test #c(-88046829568/40802189293 2.147483649d41) #'* #c(41/19 -2147483648d32) -2147483648/2147483647)
467
 
(test #c(-5.0691244239631335d0 1.3911008563333336d16)
468
 
        #'/ #c(-11/7 4312412654633334) 0.31d0)
469
 
(bool-test t #'= #c(1 0.0) 1)
470
 
 
471
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
472
 
;; complex complex
473
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
474
 
(test #c(-16.0d0 -4.0d0) #'+ #c(-16.0d0 -4.0d0))
475
 
(test #c(0d0 1d0) #'- #c(0d0 -1d0))
476
 
(test #c(1d0 3d0) #'- #c(-1d0 -3d0))
477
 
(test #c(-16.0d0 -4.0d0) #'* #c(-16.0d0 -4.0d0))
478
 
(test #c(-0.058823529411764705d0 0.014705882352941176d0) #'/ #c(-16d0 -4d0))
479
 
(test #c(1.94d0 301868863889/7) #'+ #c(3/5 5/7) #c(1.34d0 43124123412))
480
 
(test #c(8641975242/7 -3.4596d0) #'- #c(1234567890 0.0004d0) #c(-12/7 3.46d0))
481
 
(test #c(2944.315858312371d0 5.59002d13) #'* #c(-11/7 -1234d9) #c(-45.3d0 5/2147483647))
482
 
(test #c(1.9635384272224412d-8 -0.33333333317811176d0)
483
 
        #'/ #c(2147483647/3 -0.5d0) #c(128 2147483648.0d0))
484
 
(test #c(8.154945137073864d11 2.621232365490813d12)
485
 
        #'/ #c(-1.3d0 4312412654633) #c(3/2 7/15))
486
 
(test #c(0.003674737027278924d0 -257.6948748113586d0)
487
 
        #'/ #c(1.5d0 -432412) #c(1678 -567/31313))
488
 
(bool-test t #'= #c(1 2d0) #c(1 2))
489
 
(bool-test nil #'/= #c(1 2) #c(1d0 2d0))
490
 
 
491
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
492
 
;; abs
493
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
494
 
(test 2147483648 #'abs -2147483648)
495
 
(test 2147483647 #'abs -2147483647)
496
 
(test 2147483647 #'abs 2147483647)
497
 
(test 1 #'abs 1)
498
 
(test 5/7 #'abs -5/7)
499
 
(test 2147483648/2147483647 #'abs -2147483648/2147483647)
500
 
(test 3.12d0 #'abs -3.12d0)
501
 
(test 4312412341234124124123412 #'abs 4312412341234124124123412)
502
 
(test 4312412341234124124123412 #'abs -4312412341234124124123412)
503
 
(test 1.0 #'abs #c(1 0.0))
504
 
(test 11.40175425099138d0 #'abs #c(-11 3d0))
505
 
(test 4.47213595499958d0 #'abs #c(-4 -2))
506
 
(test 1.0 #'abs #c(0.0 -1.0))
507
 
 
508
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
509
 
;; sqrt
510
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
511
 
(test 3.4641016151377544d0 #'sqrt 12)
512
 
(test #c(0 12) #'sqrt -144)
513
 
(test 6.429728792199102d18 #'sqrt 41341412341234123412490123470912347210)
514
 
(test 41341412341234123412490123470912347210
515
 
        #'sqrt 1709112374367945085349927261774254951456404621200206927501652414831594784100)
516
 
(test 46340.95001184158d0 #'sqrt 2147483648)
517
 
(test 0.7071067811865476d0 #'sqrt 0.5d0)
518
 
(test 0 #'sqrt 0)
519
 
(test 0d0 #'sqrt 0d0)
520
 
(test 111.1106106544285d0 #'sqrt 12345.5678d0)
521
 
(test #c(0 11.119982014373944d0) #'sqrt -123.654d0)
522
 
(test 3/8 #'sqrt 9/64)
523
 
(test #c(0 1.1832159566199232d0) #'sqrt -7/5)
524
 
(test 514.7536007118473d0 #'sqrt 821974900428408092/3102128401119)
525
 
(test 413412341293461238946192384612893/314212341412341246128361289
526
 
        #'sqrt 170909763933741276657131032282211169869649489782500833989461829449/98729395495825697643724477479624921705328808513741521)
527
 
;; check for overflow
528
 
(error-test #'sqrt 402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
529
 
 
530
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
531
 
;; mod
532
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
533
 
(test 5 #'mod 5 9)
534
 
(test 4 #'mod -5 9)
535
 
(test -4 #'mod 5 -9)
536
 
(test -5 #'mod -5 -9)
537
 
(test 2147483646 #'mod -2147483648 2147483647)
538
 
(test -1 #'mod -2147483648 -2147483647)
539
 
(test 1 #'mod 2147483648 2147483647)
540
 
(test 0 #'mod -170909763933741276657131032282211169869649489782500833989461829449 413412341293461238946192384612893)
541
 
(test -1709112374367945085349927261774254951415063208858972804089162291360682436890
542
 
        #'mod 41341412341234123412490123470912347210 -1709112374367945085349927261774254951456404621200206927501652414831594784100)
543
 
(test 9.666666666666666d0 #'mod -1/3 10d0)
544
 
(test -9.666666666666666d0 #'mod 1/3 -10d0)
545
 
(test -0.3333333333333333d0 #'mod -1/3 -10d0)
546
 
(test 0.3333333333333333d0 #'mod 1/3 10d0)
547
 
 
548
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
549
 
;; rem
550
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
551
 
(test 2 #'rem 11 3)
552
 
(test 2 #'rem 11 -3)
553
 
(test -2 #'rem -11 3)
554
 
(test -2 #'rem -11 -3)
555
 
(test -1 #'rem -2147483648 2147483647)
556
 
(test  0.1499999999999999d0 #'rem 1.35d0 1/5)
557
 
(test  -0.1499999999999999d0 #'rem -1.35d0 1/5)
558
 
 
559
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
560
 
;; gcd
561
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
562
 
(test 11 #'gcd 33 11)
563
 
(test 7 #'gcd 91 -49)
564
 
(test 4 #'gcd -4)
565
 
(test 0 #'gcd)
566
 
(test 11 #'gcd 3333 -33 1002001)
567
 
(test 1 #'gcd -2147483648 2147483647)
568
 
 
569
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
570
 
;; lcm
571
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
572
 
(test 1 #'lcm)
573
 
(test 10 #'lcm 10)
574
 
(test 5 #'lcm -5)
575
 
(test 4611686016279904256 #'lcm -2147483648 2147483647)
576
 
(test 0 #'lcm 0 5)
577
 
(test 60 #'lcm 1 2 3 4 5 6)
578
 
 
579
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
580
 
;; and
581
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
582
 
(test -1 #'logand)
583
 
(test 0 #'logand 1 2)
584
 
(test -2147483648 #'logand -2147483648 -1)
585
 
(test 2147483647 #'logand 2147483647 -1)
586
 
(test 2147479552 #'logand 8796093018112 2147483647)
587
 
 
588
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
589
 
;; eqv
590
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
591
 
(test -1 #'logeqv)
592
 
(test -4 #'logeqv 1 2)
593
 
(test -2147483648 #'logeqv -2147483648 -1)
594
 
(test 2147483647 #'logeqv 2147483647 -1)
595
 
(test -8793945542656 #'logeqv 8796093018112 2147483647)
596
 
 
597
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
598
 
;; or
599
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
600
 
(test 0 #'logior)
601
 
(test 3 #'logior 1 2)
602
 
(test -1 #'logior -2147483648 -1)
603
 
(test -1 #'logior 2147483647 -1)
604
 
(test 8796093022207 #'logior 8796093018112 2147483647)
605
 
 
606
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
607
 
;; xor
608
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
609
 
(test 0 #'logxor)
610
 
(test 3 #'logxor 1 2)
611
 
(test 2147483647 #'logxor -2147483648 -1)
612
 
(test -2147483648 #'logxor 2147483647 -1)
613
 
(test 8793945542655 #'logxor 8796093018112 2147483647)
614
 
 
615
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
616
 
;; not
617
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
618
 
(test -1 #'lognot 0)
619
 
(test 0 #'lognot -1)
620
 
(test -2 #'lognot 1)
621
 
(test 1 #'lognot -2)
622
 
(test -3 #'lognot 2)
623
 
(test 2 #'lognot -3)
624
 
(test -2147483648 #'lognot 2147483647)
625
 
(test 2147483647 #'lognot -2147483648)
626
 
(test -8793945542656 #'lognot 8793945542655)
627
 
(test -8796093018113 #'lognot 8796093018112)
628
 
 
629
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
630
 
;; floor
631
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
632
 
(div-test 1 1/2 #'floor 3/2)
633
 
(div-test 1d0 1 #'ffloor 3 2)
634
 
(div-test -2 2147483646 #'floor -2147483648 2147483647)
635
 
(div-test 2147483648 0 #'floor -2147483648 -1)
636
 
(div-test 17179869184 0 #'floor 18446744073709551616 1073741824)
637
 
(div-test -17179869201 -1073741807 #'floor 18446744073709551616 -1073741823)
638
 
(div-test 2147483648 0d0 #'floor -2147483648 -1d0)
639
 
(div-test -2 2147483646/2147483647 #'floor -2147483648/2147483647)
640
 
(div-test 32768 32768/2147483647 #'floor 2147483648/2147483647 65535/2147483647)
641
 
(div-test -32769 -32767/2147483647 #'floor 2147483648/2147483647 -65535/2147483647)
642
 
(div-test -32769 32767/2147483647 #'floor -2147483648/2147483647 65535/2147483647)
643
 
(div-test 32768 -32768/2147483647 #'floor -2147483648/2147483647 -65535/2147483647)
644
 
(div-test 2 0.5d0 #'floor 3d0 1.25d0)
645
 
(div-test 2 1d0 #'floor 4d0 1.5d0)
646
 
(div-test -3 -0.5d0 #'floor 4d0 -1.5d0)
647
 
(div-test -3 0.5d0 #'floor -4d0 1.5d0)
648
 
(div-test 2 -1d0 #'floor -4d0 -1.5d0)
649
 
(div-test 1 2/91 #'floor 5/7 9/13)
650
 
(div-test -2 -61/91 #'floor 5/7 -9/13)
651
 
(div-test -2 61/91 #'floor -5/7 9/13)
652
 
(div-test 1 -2/91 #'floor -5/7 -9/13)
653
 
(div-test 1 0 #'floor 2147483648/2147483647 2147483648/2147483647)
654
 
(div-test -1 0 #'floor 2147483648/2147483647 -2147483648/2147483647)
655
 
(div-test -1 0 #'floor -2147483648/2147483647 2147483648/2147483647)
656
 
(div-test 1 0 #'floor -2147483648/2147483647 -2147483648/2147483647)
657
 
(div-test 9437 1416337955817765/144137437447079
658
 
        #'floor 16324116304212832041/144137437447079 12)
659
 
(div-test -9438 -313311293547183/144137437447079
660
 
        #'floor 16324116304212832041/144137437447079 -12)
661
 
(div-test -9438 313311293547183/144137437447079
662
 
        #'floor -16324116304212832041/144137437447079 12)
663
 
(div-test 9437 -1416337955817765/144137437447079
664
 
        #'floor -16324116304212832041/144137437447079 -12)
665
 
(div-test 8081 1138147903718848755797/4324123123412370
666
 
        #'floor 2147483648 1148972348912638496123/4324123123412370)
667
 
(div-test -8082 -1804074198964956721/720687187235395
668
 
        #'floor 2147483648 -1148972348912638496123/4324123123412370)
669
 
(div-test -8082 1804074198964956721/720687187235395
670
 
        #'floor -2147483648 1148972348912638496123/4324123123412370)
671
 
(div-test 8081 -1138147903718848755797/4324123123412370
672
 
        #'floor -2147483648 -1148972348912638496123/4324123123412370)
673
 
(div-test 0 1148972348912638496123/4324123123412370111
674
 
        #'floor 1148972348912638496123/4324123123412370111 2147483648)
675
 
(div-test -1 -9285982550494401861657948805/4324123123412370111
676
 
        #'floor 1148972348912638496123/4324123123412370111 -2147483648)
677
 
(div-test -1 9285982550494401861657948805/4324123123412370111
678
 
        #'floor -1148972348912638496123/4324123123412370111 2147483648)
679
 
(div-test 0 -1148972348912638496123/4324123123412370111
680
 
        #'floor -1148972348912638496123/4324123123412370111 -2147483648)
681
 
(div-test 0.0d0 1.0000000004656613d0 #'ffloor 2147483648/2147483647 2147483648d0)
682
 
(div-test -1.0d0 -2.147483647d9 #'ffloor 2147483648/2147483647 -2147483648d0)
683
 
(div-test -1.0d0 2.147483647d9 #'ffloor -2147483648/2147483647 2147483648d0)
684
 
(div-test 0.0d0 -1.0000000004656613d0 #'ffloor -2147483648/2147483647 -2147483648d0)
685
 
 
686
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
687
 
;; ceiling
688
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
689
 
(div-test 2 -1/2 #'ceiling 3/2)
690
 
(div-test 2d0 -1 #'fceiling 3 2)
691
 
(div-test -1 -1 #'ceiling -2147483648 2147483647)
692
 
(div-test 2147483648 0 #'ceiling -2147483648 -1)
693
 
(div-test 17179869184 0 #'ceiling 18446744073709551616 1073741824)
694
 
(div-test -17179869200 16 #'ceiling 18446744073709551616 -1073741823)
695
 
(div-test 2147483648 0d0 #'ceiling -2147483648 -1d0)
696
 
(div-test -1 -1/2147483647 #'ceiling -2147483648/2147483647)
697
 
(div-test 32769 -32767/2147483647 #'ceiling 2147483648/2147483647 65535/2147483647)
698
 
(div-test -32768 32768/2147483647 #'ceiling 2147483648/2147483647 -65535/2147483647)
699
 
(div-test -32768 -32768/2147483647 #'ceiling -2147483648/2147483647 65535/2147483647)
700
 
(div-test 32769 32767/2147483647 #'ceiling -2147483648/2147483647 -65535/2147483647)
701
 
(div-test 3 -0.75d0 #'ceiling 3d0 1.25d0)
702
 
(div-test 3 -0.5d0 #'ceiling 4d0 1.5d0)
703
 
(div-test -2 1d0 #'ceiling 4d0 -1.5d0)
704
 
(div-test -2 -1d0 #'ceiling -4d0 1.5d0)
705
 
(div-test 3 0.5d0 #'ceiling -4d0 -1.5d0)
706
 
(div-test 2 -61/91 #'ceiling 5/7 9/13)
707
 
(div-test -1 2/91 #'ceiling 5/7 -9/13)
708
 
(div-test -1 -2/91 #'ceiling -5/7 9/13)
709
 
(div-test 2 61/91 #'ceiling -5/7 -9/13)
710
 
(div-test 1 0 #'ceiling 2147483648/2147483647 2147483648/2147483647)
711
 
(div-test -1 0 #'ceiling 2147483648/2147483647 -2147483648/2147483647)
712
 
(div-test -1 0 #'ceiling -2147483648/2147483647 2147483648/2147483647)
713
 
(div-test 1 0 #'ceiling -2147483648/2147483647 -2147483648/2147483647)
714
 
(div-test 9438 -313311293547183/144137437447079
715
 
        #'ceiling 16324116304212832041/144137437447079 12)
716
 
(div-test -9437 1416337955817765/144137437447079
717
 
        #'ceiling 16324116304212832041/144137437447079 -12)
718
 
(div-test -9437 -1416337955817765/144137437447079
719
 
        #'ceiling -16324116304212832041/144137437447079 12)
720
 
(div-test 9438 313311293547183/144137437447079
721
 
        #'ceiling -16324116304212832041/144137437447079 -12)
722
 
(div-test 8082 -1804074198964956721/720687187235395
723
 
        #'ceiling 2147483648 1148972348912638496123/4324123123412370)
724
 
(div-test -8081 1138147903718848755797/4324123123412370
725
 
        #'ceiling 2147483648 -1148972348912638496123/4324123123412370)
726
 
(div-test -8081 -1138147903718848755797/4324123123412370
727
 
        #'ceiling -2147483648 1148972348912638496123/4324123123412370)
728
 
(div-test 8082 1804074198964956721/720687187235395
729
 
        #'ceiling -2147483648 -1148972348912638496123/4324123123412370)
730
 
(div-test 1 -9285982550494401861657948805/4324123123412370111
731
 
        #'ceiling 1148972348912638496123/4324123123412370111 2147483648)
732
 
(div-test 0 1148972348912638496123/4324123123412370111
733
 
        #'ceiling 1148972348912638496123/4324123123412370111 -2147483648)
734
 
(div-test 0 -1148972348912638496123/4324123123412370111
735
 
        #'ceiling -1148972348912638496123/4324123123412370111 2147483648)
736
 
(div-test 1 9285982550494401861657948805/4324123123412370111
737
 
        #'ceiling -1148972348912638496123/4324123123412370111 -2147483648)
738
 
(div-test 1.0d0 -2.147483647d9 #'fceiling 2147483648/2147483647 2147483648d0)
739
 
(div-test 0d0 1.0000000004656613d0 #'fceiling 2147483648/2147483647 -2147483648d0)
740
 
(div-test 0d0 -1.0000000004656613d0 #'fceiling -2147483648/2147483647 2147483648d0)
741
 
(div-test 1d0 2.147483647d9 #'fceiling -2147483648/2147483647 -2147483648d0)
742
 
 
743
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
744
 
;; truncate
745
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
746
 
(div-test 1 1/2 #'truncate 3/2)
747
 
(div-test 1d0 1 #'ftruncate 3 2)
748
 
(div-test -1 -1 #'truncate -2147483648 2147483647)
749
 
(div-test 2147483648 0 #'truncate -2147483648 -1)
750
 
(div-test 17179869184 0 #'truncate 18446744073709551616 1073741824)
751
 
(div-test -17179869200 16 #'truncate 18446744073709551616 -1073741823)
752
 
(div-test 2147483648 0d0 #'truncate -2147483648 -1d0)
753
 
(div-test -1 -1/2147483647 #'truncate -2147483648/2147483647)
754
 
(div-test 32768 32768/2147483647 #'truncate 2147483648/2147483647 65535/2147483647)
755
 
(div-test -32768 32768/2147483647 #'truncate 2147483648/2147483647 -65535/2147483647)
756
 
(div-test -32768 -32768/2147483647 #'truncate -2147483648/2147483647 65535/2147483647)
757
 
(div-test 32768 -32768/2147483647 #'truncate -2147483648/2147483647 -65535/2147483647)
758
 
(div-test 2 0.5d0 #'truncate 3d0 1.25d0)
759
 
(div-test 2 1d0 #'truncate 4d0 1.5d0)
760
 
(div-test -2 1d0 #'truncate 4d0 -1.5d0)
761
 
(div-test -2 -1d0 #'truncate -4d0 1.5d0)
762
 
(div-test 2 -1d0 #'truncate -4d0 -1.5d0)
763
 
(div-test 1 2/91 #'truncate 5/7 9/13)
764
 
(div-test -1 2/91 #'truncate 5/7 -9/13)
765
 
(div-test -1 -2/91 #'truncate -5/7 9/13)
766
 
(div-test 1 -2/91 #'truncate -5/7 -9/13)
767
 
(div-test 1 0 #'truncate 2147483648/2147483647 2147483648/2147483647)
768
 
(div-test -1 0 #'truncate 2147483648/2147483647 -2147483648/2147483647)
769
 
(div-test -1 0 #'truncate -2147483648/2147483647 2147483648/2147483647)
770
 
(div-test 1 0 #'truncate -2147483648/2147483647 -2147483648/2147483647)
771
 
(div-test 9437 1416337955817765/144137437447079
772
 
        #'truncate 16324116304212832041/144137437447079 12)
773
 
(div-test -9437 1416337955817765/144137437447079
774
 
        #'truncate 16324116304212832041/144137437447079 -12)
775
 
(div-test -9437 -1416337955817765/144137437447079
776
 
        #'truncate -16324116304212832041/144137437447079 12)
777
 
(div-test 9437 -1416337955817765/144137437447079
778
 
        #'truncate -16324116304212832041/144137437447079 -12)
779
 
(div-test 8081 1138147903718848755797/4324123123412370
780
 
        #'truncate 2147483648 1148972348912638496123/4324123123412370)
781
 
(div-test -8081 1138147903718848755797/4324123123412370
782
 
        #'truncate 2147483648 -1148972348912638496123/4324123123412370)
783
 
(div-test -8081 -1138147903718848755797/4324123123412370
784
 
        #'truncate -2147483648 1148972348912638496123/4324123123412370)
785
 
(div-test 8081 -1138147903718848755797/4324123123412370
786
 
        #'truncate -2147483648 -1148972348912638496123/4324123123412370)
787
 
(div-test 0 1148972348912638496123/4324123123412370111
788
 
        #'truncate 1148972348912638496123/4324123123412370111 2147483648)
789
 
(div-test 0 1148972348912638496123/4324123123412370111
790
 
        #'truncate 1148972348912638496123/4324123123412370111 -2147483648)
791
 
(div-test 0 -1148972348912638496123/4324123123412370111
792
 
        #'truncate -1148972348912638496123/4324123123412370111 2147483648)
793
 
(div-test 0 -1148972348912638496123/4324123123412370111
794
 
        #'truncate -1148972348912638496123/4324123123412370111 -2147483648)
795
 
(div-test 0d0 1.0000000004656613d0 #'ftruncate 2147483648/2147483647 2147483648d0)
796
 
(div-test 0d0 1.0000000004656613d0 #'ftruncate 2147483648/2147483647 -2147483648d0)
797
 
(div-test 0d0 -1.0000000004656613d0 #'ftruncate -2147483648/2147483647 2147483648d0)
798
 
(div-test 0d0 -1.0000000004656613d0 #'ftruncate -2147483648/2147483647 -2147483648d0)
799
 
 
800
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
801
 
;; round
802
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
803
 
(div-test 2 -1/2 #'round 3/2)
804
 
(div-test 2d0 -1 #'fround 3 2)
805
 
(div-test -1 -1 #'round -2147483648 2147483647)
806
 
(div-test 2147483648 0 #'round -2147483648 -1)
807
 
(div-test 17179869184 0 #'round 18446744073709551616 1073741824)
808
 
(div-test -17179869200 16 #'round 18446744073709551616 -1073741823)
809
 
(div-test 2147483648 0d0 #'round -2147483648 -1d0)
810
 
(div-test -1 -1/2147483647 #'round -2147483648/2147483647)
811
 
(div-test 32769 -32767/2147483647 #'round 2147483648/2147483647 65535/2147483647)
812
 
(div-test -32769 -32767/2147483647 #'round 2147483648/2147483647 -65535/2147483647)
813
 
(div-test -32769 32767/2147483647 #'round -2147483648/2147483647 65535/2147483647)
814
 
(div-test 32769 32767/2147483647 #'round -2147483648/2147483647 -65535/2147483647)
815
 
(div-test 2 0.5d0 #'round 3d0 1.25d0)
816
 
(div-test 3 -0.5d0 #'round 4d0 1.5d0)
817
 
(div-test -3 -0.5d0 #'round 4d0 -1.5d0)
818
 
(div-test -3 0.5d0 #'round -4d0 1.5d0)
819
 
(div-test 3 0.5d0 #'round -4d0 -1.5d0)
820
 
(div-test 1 2/91 #'round 5/7 9/13)
821
 
(div-test -1 2/91 #'round 5/7 -9/13)
822
 
(div-test -1 -2/91 #'round -5/7 9/13)
823
 
(div-test 1 -2/91 #'round -5/7 -9/13)
824
 
(div-test 1 0 #'round 2147483648/2147483647 2147483648/2147483647)
825
 
(div-test -1 0 #'round 2147483648/2147483647 -2147483648/2147483647)
826
 
(div-test -1 0 #'round -2147483648/2147483647 2147483648/2147483647)
827
 
(div-test 1 0 #'round -2147483648/2147483647 -2147483648/2147483647)
828
 
(div-test 9438 -313311293547183/144137437447079
829
 
        #'round 16324116304212832041/144137437447079 12)
830
 
(div-test -9438 -313311293547183/144137437447079
831
 
        #'round 16324116304212832041/144137437447079 -12)
832
 
(div-test -9438 313311293547183/144137437447079
833
 
        #'round -16324116304212832041/144137437447079 12)
834
 
(div-test 9438 313311293547183/144137437447079
835
 
        #'round -16324116304212832041/144137437447079 -12)
836
 
(div-test 8082 -1804074198964956721/720687187235395
837
 
        #'round 2147483648 1148972348912638496123/4324123123412370)
838
 
(div-test -8082 -1804074198964956721/720687187235395
839
 
        #'round 2147483648 -1148972348912638496123/4324123123412370)
840
 
(div-test -8082 1804074198964956721/720687187235395
841
 
        #'round -2147483648 1148972348912638496123/4324123123412370)
842
 
(div-test 8082 1804074198964956721/720687187235395
843
 
        #'round -2147483648 -1148972348912638496123/4324123123412370)
844
 
(div-test 0 1148972348912638496123/4324123123412370111
845
 
        #'round 1148972348912638496123/4324123123412370111 2147483648)
846
 
(div-test 0 1148972348912638496123/4324123123412370111
847
 
        #'round 1148972348912638496123/4324123123412370111 -2147483648)
848
 
(div-test 0 -1148972348912638496123/4324123123412370111
849
 
        #'round -1148972348912638496123/4324123123412370111 2147483648)
850
 
(div-test 0 -1148972348912638496123/4324123123412370111
851
 
        #'round -1148972348912638496123/4324123123412370111 -2147483648)
852
 
(div-test 0d0 1.0000000004656613d0 #'fround 2147483648/2147483647 2147483648d0)
853
 
(div-test 0d0 1.0000000004656613d0 #'fround 2147483648/2147483647 -2147483648d0)
854
 
(div-test 0d0 -1.0000000004656613d0 #'fround -2147483648/2147483647 2147483648d0)
855
 
(div-test 0d0 -1.0000000004656613d0 #'fround -2147483648/2147483647 -2147483648d0)
856
 
(div-test 2 0.5d0 #'round 2.5d0)
857
 
(div-test -2 -0.5d0 #'round -2.5d0)
858
 
(div-test 5 0d0 #'round 2.5d0 0.5d0)
859
 
(div-test -5 0d0 #'round 2.5d0 -0.5d0)
860
 
(div-test -5 0d0 #'round 2.5d0 -0.5d0)
861
 
(div-test -5 0d0 #'round -2.5d0 0.5d0)
862
 
(div-test 5 0d0 #'round -2.5d0 -0.5d0)
863
 
(div-test 1 -2/7 #'round 5/7)
864
 
(div-test -1 2/7 #'round -5/7)
865
 
(div-test 2 -1/2 #'round 3/2)
866
 
(div-test -2 1/2 #'round -3/2)
867
 
(div-test 2 1 #'round 30/2 7)
868
 
(div-test -2 1 #'round 30/2 -7)
869
 
(div-test -2 -1 #'round -30/2 7)
870
 
(div-test 2 -1 #'round -30/2 -7)
871
 
(div-test 1073741824 -1/2 #'round 2147483647/2)
872
 
(div-test -1073741824 1/2 #'round -2147483647/2)
873
 
(div-test 1 -2147483645/2 #'round 2147483647/2 2147483646)
874
 
(div-test -1 -2147483645/2 #'round 2147483647/2 -2147483646)
875
 
(div-test -1 2147483645/2 #'round -2147483647/2 2147483646)
876
 
(div-test 1 -2147483645/2 #'round 2147483647/2 2147483646)
877
 
 
878
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
879
 
;; misc
880
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
881
 
(test #c(5 -5) #'conjugate #c(5 5))
882
 
(test #c(5 5) #'conjugate #c(5 -5))
883
 
(test #c(-5 -5) #'conjugate #c(-5 5))
884
 
(test #c(-5 5) #'conjugate #c(-5 -5))
885
 
 
886
 
(test 1 #'denominator 10)
887
 
(test 3 #'denominator 10/3)
888
 
(test 3 #'denominator 1804074198964956721/3)
889
 
(test 4324123123412370111 #'denominator -1148972348912638496123/4324123123412370111)
890
 
 
891
 
(bool-test nil #'evenp -1)
892
 
(bool-test t #'evenp -2147483648)
893
 
(bool-test t #'evenp -4294967296)
894
 
(bool-test nil #'evenp -4294967295)
895
 
 
896
 
(test 0.5d0 #'float 1/2)
897
 
(test 10.0d0 #'float 10)
898
 
(test 4.978341823462786d22 #'float 49783418234627861238926)
899
 
(test 1.845867531346429d12 #'float 643827946123846123984/348794231)
900
 
 
901
 
(bool-test t #'floatp 0.3d0)
902
 
(bool-test nil #'floatp 1/3)
903
 
 
904
 
(test 0 #'imagpart 1)
905
 
(test -5 #'imagpart #c(1 -5))
906
 
 
907
 
(bool-test t #'integerp 12)
908
 
(bool-test nil #'integerp 1/2)
909
 
(bool-test nil #'integerp :test)
910
 
(bool-test nil #'integerp 0d0)
911
 
(bool-test t #'integerp 49783418234627861238926)
912
 
 
913
 
(test 3 #'isqrt 12)
914
 
(test 46340 #'isqrt 2147483648)
915
 
(test 46340 #'isqrt 2147483647)
916
 
(test 25373764918 #'isqrt 643827946123846123984)
917
 
 
918
 
(bool-test nil #'logtest 1 2)
919
 
(bool-test t #'logtest 1 3)
920
 
(bool-test t #'logtest 7 -1)
921
 
 
922
 
(bool-test nil #'minusp 0)
923
 
(bool-test nil #'minusp 2147483648)
924
 
(bool-test t #'minusp -2147483648)
925
 
(bool-test t #'minusp -1/4)
926
 
(bool-test nil #'minusp 0.2d0)
927
 
(bool-test nil #'minusp 0d0)
928
 
(bool-test nil #'minusp 984723891462817946123897416)
929
 
(bool-test t #'minusp -1148972348912638496123/4324123123412370111)
930
 
 
931
 
(bool-test t #'numberp #c(1 2))
932
 
(bool-test t #'numberp -200)
933
 
(bool-test nil #'numberp :test)
934
 
 
935
 
(test 10 #'numerator 10)
936
 
(test 10 #'numerator 10/3)
937
 
(test 1804074198964956721 #'numerator 1804074198964956721/3)
938
 
(test -1148972348912638496123 #'numerator -1148972348912638496123/4324123123412370111)
939
 
 
940
 
(bool-test t #'oddp -1)
941
 
(bool-test nil #'oddp -2147483648)
942
 
(bool-test nil #'oddp -4294967296)
943
 
(bool-test t #'oddp -4294967295)
944
 
 
945
 
(bool-test nil #'plusp 0)
946
 
(bool-test t #'plusp 2147483648)
947
 
(bool-test nil #'plusp -2147483648)
948
 
(bool-test nil #'plusp -1/4)
949
 
(bool-test t #'plusp 0.2d0)
950
 
(bool-test nil #'plusp 0d0)
951
 
(bool-test t #'plusp 984723891462817946123897416)
952
 
(bool-test nil #'plusp -1148972348912638496123/4324123123412370111)
953
 
 
954
 
(test 1/4 #'rational 0.25d0)
955
 
(test 5/2 #'rational 2.5d0)
956
 
(test 1/8 #'rational 0.125d0)
957
 
(test -5/8 #'rational -0.625d0)
958
 
(test 524293/8 #'rational 65536.625d0)
959
 
(test 17179869181/8 #'rational 2147483647.625d0)
960
 
 
961
 
(bool-test t #'rationalp -3)
962
 
(bool-test t #'rationalp 1/2)
963
 
(bool-test t #'rationalp 1/2412341242424122412)
964
 
(bool-test nil #'rationalp :test)
965
 
(bool-test nil #'rationalp 0d0)
966
 
(bool-test t #'rationalp 49783418234627861238926)
967
 
 
968
 
(test -1 #'realpart #c(-1 0.5d0))
969
 
 
970
 
(test 1 #'signum 123/5)
971
 
(test 0d0 #'signum 0d0)
972
 
(test -1d0 #'signum -7.3d0)
973
 
 
974
 
(bool-test nil #'zerop 1)
975
 
(bool-test nil #'zerop 1/4312412341234123412)
976
 
(bool-test nil #'zerop 0.000003d0)
977
 
(bool-test t #'zerop 0)
978
 
(bool-test t #'zerop 0d0)
979
 
(bool-test t #'zerop #c(0 0d0))
980
 
 
981
 
(bool-test t #'= 10 #c(10 0d0))
982