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.

Changeset 3713 for branches/f4grobner


Ignore:
Timestamp:
2015-09-06T07:38:35-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r3712 r3713  
    481481destructively modifies F and P."
    482482  (polysaturation-extension f (list p)))
     483
     484(defgeneric universal-expt (x y)
     485  (:method ((x number) (y integer)) (expt x y))
     486  (:method ((x t) (y integer))
     487    (declare (type fixnum y))
     488    (cond
     489      ((minusp y) (error "universal-expt: Negative exponent."))
     490      ((universal-zerop x) (if (zerop y) 1))
     491      (t
     492       (do ((k 1 (ash k 1))
     493            (q x (multiply q q))        ;keep squaring
     494            (p 1 (if (not (zerop (logand k y))) (multiply p q) p)))
     495           ((> k y) p)
     496         (declare (fixnum k))))))
     497  (:documentation "Raises X to power Y."))
Note: See TracChangeset for help on using the changeset viewer.