File: fceiling.lsp

package info (click to toggle)
cl-ansi-tests 20071218-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,000 kB
  • ctags: 22,025
  • sloc: lisp: 134,798; makefile: 144
file content (147 lines) | stat: -rw-r--r-- 3,677 bytes parent folder | download | duplicates (6)
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
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Wed Aug 20 06:22:23 2003
;;;; Contains: Tests of FCEILING

(in-package :cl-test)

(compile-and-load "numbers-aux.lsp")
(compile-and-load "fceiling-aux.lsp")

(deftest fceiling.error.1
  (signals-error (fceiling) program-error)
  t)

(deftest fceiling.error.2
  (signals-error (fceiling 1.0 1 nil) program-error)
  t)

;;;

(deftest fceiling.1
  (fceiling.1-fn)
  nil)

(deftest fceiling.10
  (loop for x in (remove-if #'zerop *reals*)
	for (q r) = (multiple-value-list (fceiling x x))
	unless (and (floatp q)
		    (if (floatp x)
			(eql q (float 1 x))
		      (= q 1))
		    (zerop r)
		    (if (floatp x)
			(eql r (float 0 x))
		      (= r 0)))
	collect x)
  nil)

(deftest fceiling.11
  (loop for x in (remove-if-not #'floatp (remove-if #'zerop *reals*))
	for (q r) = (multiple-value-list (fceiling  (- x) x))
	unless (and (floatp q)
		    (if (floatp x)
			(eql q (float -1 x))
		      (= q -1))
		    (zerop r)
		    (if (floatp x)
			(eql r (float 0 x))
		      (= r 0)))
	collect x)
  nil)

(deftest fceiling.12
  (let* ((radix (float-radix 1.0s0))
	 (rad (float radix 1.0s0))
	 (rrad (/ 1.0s0 rad)))
    (loop for i from 1 to 1000
	  for x = (+ i rrad)
	  for (q r) = (multiple-value-list (fceiling x))
	  unless (and (eql q (coerce (1+ i) 'short-float))
		      (eql r (- rrad 1)))
	  collect (list i x q r)))
  nil)

(deftest fceiling.13
  (let* ((radix (float-radix 1.0s0))
	 (rad (float radix 1.0s0))
	 (rrad (/ 1.0s0 rad)))
    (loop for i from 1 to 1000
	  for x = (- i rrad)
	  for (q r) = (multiple-value-list (fceiling x))
	  unless (and (eql q (coerce i 'short-float))
		      (eql r (- rrad 1)))
	  collect (list i x q r)))
  nil)

(deftest fceiling.14
  (let* ((radix (float-radix 1.0f0))
	 (rad (float radix 1.0f0))
	 (rrad (/ 1.0f0 rad)))
    (loop for i from 1 to 1000
	  for x = (+ i rrad)
	  for (q r) = (multiple-value-list (fceiling x))
	  unless (and (eql q (coerce (1+ i) 'single-float))
		      (eql r (- rrad 1)))
	  collect (list i x q r)))
  nil)

(deftest fceiling.15
  (let* ((radix (float-radix 1.0f0))
	 (rad (float radix 1.0f0))
	 (rrad (/ 1.0f0 rad)))
    (loop for i from 1 to 1000
	  for x = (- i rrad)
	  for (q r) = (multiple-value-list (fceiling x))
	  unless (and (eql q (coerce i 'single-float))
		      (eql r (- rrad 1)))
	  collect (list i x q r)))
  nil)

(deftest fceiling.16
  (let* ((radix (float-radix 1.0d0))
	 (rad (float radix 1.0d0))
	 (rrad (/ 1.0d0 rad)))
    (loop for i from 1 to 1000
	  for x = (+ i rrad)
	  for (q r) = (multiple-value-list (fceiling x))
	  unless (and (eql q (coerce (1+ i) 'double-float))
		      (eql r (- rrad 1)))
	  collect (list i x q r)))
  nil)

(deftest fceiling.17
  (let* ((radix (float-radix 1.0d0))
	 (rad (float radix 1.0d0))
	 (rrad (/ 1.0d0 rad)))
    (loop for i from 1 to 1000
	  for x = (- i rrad)
	  for (q r) = (multiple-value-list (fceiling x))
	  unless (and (eql q (coerce i 'double-float))
		      (eql r (- rrad 1)))
	  collect (list i x q r)))
  nil)

(deftest fceiling.18
  (let* ((radix (float-radix 1.0l0))
	 (rad (float radix 1.0l0))
	 (rrad (/ 1.0l0 rad)))
    (loop for i from 1 to 1000
	  for x = (+ i rrad)
	  for (q r) = (multiple-value-list (fceiling x))
	  unless (and (eql q (coerce (1+ i) 'long-float))
		      (eql r (- rrad 1)))
	  collect (list i x q r)))
  nil)

(deftest fceiling.19
  (let* ((radix (float-radix 1.0l0))
	 (rad (float radix 1.0l0))
	 (rrad (/ 1.0l0 rad)))
    (loop for i from 1 to 1000
	  for x = (- i rrad)
	  for (q r) = (multiple-value-list (fceiling x))
	  unless (and (eql q (coerce i 'long-float))
		      (eql r (- rrad 1)))
	  collect (list i x q r)))
  nil)