- Timestamp:
- 2015-08-27T08:41:06-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/ring.lisp
r3383 r3384 127 127 (:method ((x integer) (y integer)) (expt x y)) 128 128 (:method (x (y integer)) 129 &aux 130 (declare (type fixnum n)) 131 (cond 132 ((minusp n) (error "r-expt: Negative exponent.")) 133 ((endp poly) (if (zerop n) 1)) 134 (t 135 (do ((k 1 (ash k 1)) 136 (q poly (r* q q)) ;keep squaring 137 (p 1 (if (not (zerop (logand k n))) (r* (r* p q) p)))) 138 ((> k n) p) 139 (declare (fixnum k)))))) 129 (declare (type fixnum n)) 130 (cond 131 ((minusp n) (error "r-expt: Negative exponent.")) 132 ((endp poly) (if (zerop n) 1)) 133 (t 134 (do ((k 1 (ash k 1)) 135 (q poly (r* q q)) ;keep squaring 136 (p 1 (if (not (zerop (logand k n))) (r* (r* p q) p)))) 137 ((> k n) p) 138 (declare (fixnum k)))))) 140 139 (:documentation "Raises X to power Y.")) 141 140
Note:
See TracChangeset
for help on using the changeset viewer.