Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Karsten Poeck
ansi-test
Commits
d8649021
Commit
d8649021
authored
Jun 19, 2004
by
pfdietz
Browse files
Added tests of comparing bignums with floats.
parent
fddf91a3
Changes
1
Show whitespace changes
Inline
Side-by-side
ansi-tests/number-comparison.lsp
View file @
d8649021
...
...
@@ -197,7 +197,6 @@
nil))))
nil)
(deftest =.order.1
(let ((i 0) x y)
(values
...
...
@@ -1184,3 +1183,163 @@
(deftest compare-rationals.4
(compare-random-rationals 6000000000 3000000000 10000)
nil)
;;;; Comparison of bignums with floats
(deftest bignum.float.compare.1a
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (+ r (ceiling (rational x)))))
(unless (< x i)
(list (list x i))))))
nil)
(deftest bignum.float.compare.1b
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (- (floor (rational x)) r)))
(unless (< i x)
(list (list x i))))))
nil)
(deftest bignum.float.compare.2a
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (+ r (ceiling (rational x)))))
(unless (> i x)
(list (list x i))))))
nil)
(deftest bignum.float.compare.2b
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (- (floor (rational x)) r)))
(unless (> x i)
(list (list x i))))))
nil)
(deftest bignum.float.compare.3a
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (+ r (ceiling (rational x)))))
(when (or (= x i) (= i x))
(list (list x i))))))
nil)
(deftest bignum.float.compare.3b
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (- (floor (rational x)) r)))
(when (or (= x i) (= i x))
(list (list x i))))))
nil)
(deftest bignum.float.compare.4a
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (+ r (ceiling (rational x)))))
(unless (and (/= i x) (/= x i))
(list (list x i))))))
nil)
(deftest bignum.float.compare.4b
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (- (floor (rational x)) r)))
(unless (and (/= i x) (/= x i))
(list (list x i))))))
nil)
(deftest bignum.float.compare.5a
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (+ r (ceiling (rational x)))))
(unless (<= x i)
(list (list x i))))))
nil)
(deftest bignum.float.compare.5b
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (- (floor (rational x)) r)))
(unless (<= i x)
(list (list x i))))))
nil)
(deftest bignum.float.compare.6a
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (+ r (ceiling (rational x)))))
(unless (>= i x)
(list (list x i))))))
nil)
(deftest bignum.float.compare.6b
(loop for x in *floats*
when (or (<= (abs x) 1)
(< (abs (log (abs x))) 10000))
nconc
(loop for r = (1+ (random (ash 1 (random 32))))
repeat 200
nconc
(let ((i (- (floor (rational x)) r)))
(unless (>= x i)
(list (list x i))))))
nil)
;;; To add ... comparisons of large rationals with floats
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment