source: trunk/source/tests/ansi-tests/ceiling-aux.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 2.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Aug 19 06:52:02 2003
4;;;; Contains: Aux. functions for CEILING
5
6(in-package :cl-test)
7
8(defun ceiling.1-fn ()
9  (loop for n = (- (random 2000000000)
10                   1000000000)
11        for d = (1+ (random 10000))
12        for vals = (multiple-value-list (ceiling n d))
13        for (q r) = vals
14        for n2 = (+ (* q d) r)
15        repeat 1000
16        unless (and (eql (length vals) 2)
17                    (integerp q)
18                    (= n n2)
19                    (integerp r)
20                    (< (- d) r 1))
21        collect (list n d q r n2)))
22
23(defun ceiling.2-fn ()
24  (loop for num = (random 1000000000)
25        for denom = (1+ (random 1000))
26        for n = (/ num denom)
27        for d = (1+ (random 10000))
28        for vals = (multiple-value-list (ceiling n d))
29        for (q r) = vals
30        for n2 = (+ (* q d) r)
31        repeat 1000
32        unless (and (eql (length vals) 2)
33                    (integerp q)
34                    (<= r 0)
35                    (< (- d) r)
36                    (= n n2))
37        collect (list n d q r n2)))
38
39(defun ceiling.3-fn (width)
40  (loop for n = (- (random width) (/ width 2))
41        for vals = (multiple-value-list (ceiling n))
42        for (q r) = vals
43        for n2 = (+ q r)
44        repeat 1000
45        unless (and (eql (length vals) 2)
46                    (integerp q)
47                    (= n n2)
48                    (<= 0 (- r))
49                    (< (- r) 1)
50                    )
51        collect (list n q r n2)))
52
53(defun ceiling.7-fn ()
54  (loop for numerator = (- (random 10000000000) 5000000000)
55        for denominator = (1+ (random 100000))
56        for n = (/ numerator denominator)
57        for vals = (multiple-value-list (ceiling n))
58        for (q r) = vals
59        for n2 = (+ q r)
60        repeat 1000
61        unless (and (eql (length vals) 2)
62                    (integerp q)
63                    (rationalp r)
64                    (= n n2)
65                    (<= 0 (- r))
66                    (< (- r) 1)
67                    )
68        collect (list n q r n2)))
69
70(defun ceiling.8-fn ()
71  (loop for num1 = (- (random 10000000000) 5000000000)
72        for den1 = (1+ (random 100000))
73        for n = (/ num1 den1)
74        for num2 = (- (1+ (random 1000000)))
75        for den2 = (1+ (random 1000000))
76        for d = (/ num2 den2)
77        for vals = (multiple-value-list (ceiling n d))
78        for (q r) = vals
79        for n2 = (+ (* q d) r)
80        repeat 1000
81        unless (and (eql (length vals) 2)
82                    (integerp q)
83                    (rationalp r)
84                    (<= 0 r)
85                    (< r (- d))
86                    (= n n2))
87        collect (list n q d r n2)))
88
89(defun ceiling.9-fn ()
90  (loop for num1 = (- (random 1000000000000000) 500000000000000)
91        for den1 = (1+ (random 10000000000))
92        for n = (/ num1 den1)
93        for num2 = (- (1+ (random 1000000000)))
94        for den2 = (1+ (random 10000000))
95        for d = (/ num2 den2)
96        for vals = (multiple-value-list (ceiling n d))
97        for (q r) = vals
98        for n2 = (+ (* q d) r)
99        repeat 1000
100        unless (and (eql (length vals) 2)
101                    (integerp q)
102                    (rationalp r)
103                    (<= 0 r)
104                    (< r (- d))
105                    (= n n2))
106        collect (list n q d r n2)))
Note: See TracBrowser for help on using the repository browser.