X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Farith.pure.lisp;h=db7cbe5d63991d20063a6ac63413a46c043659cd;hb=33b3c0e45a34f035fa918682832f1affa6747930;hp=bef097cc95250c706e8fd1abcf3dea8c5c1fd8ca;hpb=178128629005f3b6b8c40bbb510b498d7552f13c;p=sbcl.git diff --git a/tests/arith.pure.lisp b/tests/arith.pure.lisp index bef097c..db7cbe5 100644 --- a/tests/arith.pure.lisp +++ b/tests/arith.pure.lisp @@ -73,3 +73,17 @@ ASSERTion fails, probably in something related to bug #194. (assert (null (ignore-errors (max 3 #'max)))) (assert (= (max -3 0) 0)) ||# + +;;; (CEILING x 2^k) was optimized incorrectly +(loop for divisor in '(-4 4) + for ceiler = (compile nil `(lambda (x) + (declare (fixnum x)) + (declare (optimize (speed 3))) + (ceiling x ,divisor))) + do (loop for i from -5 to 5 + for exact-q = (/ i divisor) + do (multiple-value-bind (q r) + (funcall ceiler i) + (assert (= (+ (* q divisor) r) i)) + (assert (<= exact-q q)) + (assert (< q (1+ exact-q))))))