[git] CMU Common Lisp branch master updated. snapshot-2013-11-2-g20ee8ef

Raymond Toy rtoy at common-lisp.net
Fri Nov 8 06:34:03 UTC 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, master has been updated
       via  20ee8ef20cd01a0be841695d6beaf98968e5be31 (commit)
      from  373bc974935a33ff1515d0d1cce2af8f7d910c04 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 20ee8ef20cd01a0be841695d6beaf98968e5be31
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Thu Nov 7 22:33:42 2013 -0800

    Add shortcut for (expt -1 power).

diff --git a/src/code/irrat.lisp b/src/code/irrat.lisp
index 67ca060..927a5fb 100644
--- a/src/code/irrat.lisp
+++ b/src/code/irrat.lisp
@@ -318,11 +318,13 @@
 ;;; of power are calculated as positive integers, and inverted if negative.
 ;;;
 (defun intexp (base power)
-  ;; Handle the special case of 1^power.  Maxima sometimes does this,
-  ;; and there's no need to cause a continuable error in this case.
-  ;; Should we also handle (-1)^power?
+  ;; Handle the special case of 1^power and (-1)^power.  Maxima
+  ;; sometimes does this, and there's no need to cause a continuable
+  ;; error in this case.
   (when (eql base 1)
     (return-from intexp base))
+  (when (eql base -1)
+    (return-from intexp (if (oddp power) -1 1)))
   
   (when (> (abs power) *intexp-maximum-exponent*)
     ;; Allow user the option to continue with calculation, possibly

-----------------------------------------------------------------------

Summary of changes:
 src/code/irrat.lisp |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp



More information about the cmucl-cvs mailing list