2
;;;; Author: Paul Dietz
3
;;;; Created: Wed Feb 11 19:53:33 2004
4
;;;; Contains: Tests of LOG
9
(let ((result (log 1)))
15
(mapcar #'log '(1.0s0 1.0f0 1.0d0 1.0l0))
16
(0.0s0 0.0f0 0.0d0 0.0l0))
19
(loop for type in '(short-float single-float double-float long-float)
22
for x = (+ (random (coerce 1 type)) (/ 1 1000))
23
for rlist = (multiple-value-list (log x))
26
unless (and (null (cdr rlist))
28
collect (list x rlist)))
32
(loop for type in '(short-float single-float double-float long-float)
35
for x = (1+ (random (coerce 1000000 type)))
36
for rlist = (multiple-value-list (log x))
39
unless (and (null (cdr rlist))
41
collect (list x rlist)))
45
(loop for type in '(short-float single-float double-float long-float)
46
for zero = (coerce 0 type)
49
for x = (- (random (coerce 1 type)))
50
for rlist = (and (/= x zero) (multiple-value-list (log x)))
54
(and (null (cdr rlist))
55
(typep y `(complex ,type))))
56
collect (list x rlist)))
60
(loop for type in '(short-float single-float double-float long-float)
61
for zero = (coerce 0 type)
64
for x = (- (random (coerce 1000000 type)))
65
for rlist = (and (/= x zero) (multiple-value-list (log x)))
69
(and (null (cdr rlist))
70
(typep y `(complex ,type))))
71
collect (list x rlist)))
75
(loop for type in '(short-float single-float double-float long-float)
76
for zero = (coerce 0 type)
79
for x1 = (- (random (coerce 2000 type)) 1000)
80
for x2 = (1+ (random (coerce 1000 type)))
81
for rlist = (and (/= x1 zero)
82
(multiple-value-list (log (complex x1 x2))))
85
unless (or (= x1 zero)
86
(and (null (cdr rlist))
87
(typep y `(complex ,type))))
88
collect (list x1 x2 rlist)))
92
(loop for type in '(short-float single-float double-float long-float)
93
for zero = (coerce 0 type)
96
for x1 = (- (random (coerce 2000 type)) 1000)
97
for x2 = (- -1 (random (coerce 1000 type)))
98
for rlist = (and (/= x1 zero)
99
(multiple-value-list (log (complex x1 x2))))
102
unless (or (= x1 zero)
103
(and (null (cdr rlist))
104
(typep y `(complex ,type))))
105
collect (list x1 x2 rlist)))
109
;;; Add tests for two-arg calls
112
;;; More accuracy tests here
117
(signals-error (log) program-error)
121
(signals-error (log 1.0 2.0 3.0) program-error)