[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/calculator.el,v
From: |
Jay Belanger |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/calculator.el,v |
Date: |
Wed, 04 Jul 2007 13:53:11 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Jay Belanger <jpb> 07/07/04 13:53:11
Index: calculator.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calculator.el,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- calculator.el 4 Jul 2007 04:17:21 -0000 1.27
+++ calculator.el 4 Jul 2007 13:53:11 -0000 1.28
@@ -1793,14 +1793,28 @@
(expt x y)
(domain-error 0.0e+NaN)
(range-error
- (if (> y 0)
- (if (and
- (< x 0)
- (= y (truncate y))
- (oddp (truncate y)))
- -1.0e+INF
+ (cond
+ ((and (< x 1.0) (> x -1.0))
+ ;; For small x, the range error comes from large y.
+ 0.0)
+ ((and (> x 0.0) (< y 0.0))
+ ;; For large positive x and negative y, the range error
+ ;; comes from large negative y.
+ 0.0)
+ ((and (> x 0.0) (> y 0.0))
+ ;; For large positive x and positive y, the range error
+ ;; comes from large y.
1.0e+INF)
- 0.0))
+ ;; For the rest, x must be large and negative.
+ ;; The range errors come from large integer y.
+ ((< y 0.0)
+ 0.0)
+ ((oddp (truncate y))
+ ;; If y is odd
+ -1.0e+INF)
+ (t
+ ;;
+ 1.0e+INF)))
(error 0.0e+NaN)))
(defun calculator-fact (x)