close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Ignore:
Timestamp:
2015-08-27T08:39:42-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/ring.lisp

    r3275 r3383  
    126126(defgeneric r-expt (x y)
    127127  (:method ((x integer) (y integer)) (expt x y))
     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))))))
    128140  (:documentation "Raises X to power Y."))
    129141
Note: See TracChangeset for help on using the changeset viewer.