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:
684 bytes

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Thu Aug 28 11:23:40 2003 

4  ;;;; Contains: Auxiliary functions for testing the multiplication operator * 

5  

6  (inpackage :cltest) 

7  

8  (defun integertimes (x y) 

9  (assert (integerp x)) 

10  (assert (integerp y)) 

11  (let (neg) 

12  (when (< x 0) 

13  (setq neg t x ( x))) 

14  (let ((result (nattimes x y))) 

15  (if neg ( result) result)))) 

16  

17  (defun nattimes (x y) 

18  ;; Assumes x >= 0 

19  (if (= x 0) 

20  0 

21  (let ((lo (if (oddp x) y 0)) 

22  (hi (nattimes (ash x 1) y))) 

23  (+ lo (+ hi hi))))) 

24  

25  (defun rattimes (x y) 

26  (/ (integertimes (numerator x) (numerator y)) 

27  (integertimes (denominator x) (denominator y)))) 

Note: See
TracBrowser
for help on using the repository browser.