v15i030: Patch for GNU Emacs Calc, version 1.04 -> 1.05, part 03/20

David Gillespie daveg at csvax.cs.caltech.edu
Mon Oct 15 11:15:35 AEST 1990


Posting-number: Volume 15, Issue 30
Submitted-by: daveg at csvax.cs.caltech.edu (David Gillespie)
Archive-name: calc-1.05/part03

#!/bin/sh
# this is part 3 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file calc.patch continued
#
CurArch=3
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
sed 's/^X//' << 'SHAR_EOF' >> calc.patch
X--- 2428,2435 ----
X  	    (cons (car a) args))))))
X  )
X  
X+ ;;;; [calc-macs.el]
X+ 
X  (defmacro math-with-extra-prec (delta &rest body)
X    (` (math-normalize
X        (let ((calc-internal-prec (+ calc-internal-prec (, delta))))
X***************
X*** 2316,2338 ****
X  )
X  (put 'math-with-extra-prec 'lisp-indent-hook 1)
X  
X- ;;; Define "inexact-result" as an e-lisp error symbol.
X- (put 'inexact-result 'error-conditions '(error inexact-result calc-error))
X- (put 'inexact-result 'error-message "Calc internal error (inexact-result)")
X  
X! ;;; Normalize a bignum digit list by trimming high-end zeros.  [L l]
X! (defun math-norm-bignum (a)
X!   (let ((digs a) (last nil))
X!     (while digs
X!       (or (eq (car digs) 0) (setq last digs))
X!       (setq digs (cdr digs)))
X!     (and last
X! 	 (progn
X! 	   (setcdr last nil)
X! 	   a)))
X! )
X  
X- 
X  ;;; Concatenate two vectors, or a vector and an object.  [V O O] [Public]
X  (defun math-concat (v1 v2)
X    (if (stringp v1)
X--- 2437,2445 ----
X  )
X  (put 'math-with-extra-prec 'lisp-indent-hook 1)
X  
X  
X! ;;;; [calc-misc.el]
X  
X  ;;; Concatenate two vectors, or a vector and an object.  [V O O] [Public]
X  (defun math-concat (v1 v2)
X    (if (stringp v1)
X***************
X*** 2372,2377 ****
X--- 2479,2487 ----
X  		  (math-zerop (nth 3 a)))))
X      (eq a 0))
X  )
X+ 
X+ ;;;; [calc-macs.el]
X+ 
X  ;;; Faster in-line version zerop, normalized values only.
X  (defmacro Math-zerop (a)   ; [P N]
X    (` (if (consp (, a))
X***************
X*** 2382,2394 ****
X         (eq (, a) 0)))
X  )
X  
X- (defun math-zerop-bignum (a)
X-   (and (eq (car a) 0)
X-        (progn
X- 	 (while (eq (car (setq a (cdr a))) 0))
X- 	 (null a)))
X- )
X- 
X  (defmacro Math-natnum-lessp (a b)
X    (` (if (consp (, a))
X  	 (and (consp (, b))
X--- 2492,2497 ----
X***************
X*** 2409,2424 ****
X         (> (, a) 0)))
X  )
X  
X  ;;; True if A is real and negative.  [P n] [Public]
X  (defun math-negp (a)
X    (if (consp a)
X        (cond ((eq (car a) 'bigpos) nil)
X  	    ((eq (car a) 'bigneg) (cdr a))
X! 	    ((eq (car a) 'frac)
X! 	     (if (Math-integer-negp (nth 2 a))
X! 		 (Math-integer-posp (nth 1 a))
X! 	       (Math-integer-negp (nth 1 a))))
X! 	    ((eq (car a) 'float)
X  	     (Math-integer-negp (nth 1 a)))
X  	    ((eq (car a) 'hms)
X  	     (if (math-zerop (nth 1 a))
X--- 2512,2526 ----
X         (> (, a) 0)))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  ;;; True if A is real and negative.  [P n] [Public]
X+ 
X  (defun math-negp (a)
X    (if (consp a)
X        (cond ((eq (car a) 'bigpos) nil)
X  	    ((eq (car a) 'bigneg) (cdr a))
X! 	    ((memq (car a) '(float frac))
X  	     (Math-integer-negp (nth 1 a)))
X  	    ((eq (car a) 'hms)
X  	     (if (math-zerop (nth 1 a))
X***************
X*** 2432,2437 ****
X--- 2534,2542 ----
X  		      (memq (nth 1 a) '(0 2))))))
X      (< a 0))
X  )
X+ 
X+ ;;;; [calc-macs.el]
X+ 
X  (defmacro Math-negp (a)
X    (` (if (consp (, a))
X  	 (or (eq (car (, a)) 'bigneg)
X***************
X*** 2442,2447 ****
X--- 2547,2554 ----
X         (< (, a) 0)))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  ;;; True if A is a negative number or an expression the starts with '-'.
X  (defun math-looks-negp (a)   ; [P x] [Public]
X    (or (Math-negp a)
X***************
X*** 2450,2455 ****
X--- 2557,2565 ----
X  	   (or (math-looks-negp (nth 1 a))
X  	       (math-looks-negp (nth 2 a)))))
X  )
X+ 
X+ ;;;; [calc-macs.el]
X+ 
X  (defmacro Math-looks-negp (a)   ; [P x] [Public]
X    (` (or (Math-negp (, a))
X  	 (and (consp (, a)) (or (eq (car (, a)) 'neg)
X***************
X*** 2458,2473 ****
X  					 (math-looks-negp (nth 2 (, a)))))))))
X  )
X  
X  ;;; True if A is real and positive.  [P n] [Public]
X  (defun math-posp (a)
X    (if (consp a)
X        (cond ((eq (car a) 'bigpos) (cdr a))
X  	    ((eq (car a) 'bigneg) nil)
X! 	    ((eq (car a) 'frac)
X! 	     (if (Math-integer-negp (nth 2 a))
X! 		 (Math-integer-negp (nth 1 a))
X! 	       (Math-integer-posp (nth 1 a))))
X! 	    ((eq (car a) 'float)
X  	     (Math-integer-posp (nth 1 a)))
X  	    ((eq (car a) 'hms)
X  	     (if (math-zerop (nth 1 a))
X--- 2568,2581 ----
X  					 (math-looks-negp (nth 2 (, a)))))))))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  ;;; True if A is real and positive.  [P n] [Public]
X  (defun math-posp (a)
X    (if (consp a)
X        (cond ((eq (car a) 'bigpos) (cdr a))
X  	    ((eq (car a) 'bigneg) nil)
X! 	    ((memq (car a) '(float frac))
X  	     (Math-integer-posp (nth 1 a)))
X  	    ((eq (car a) 'hms)
X  	     (if (math-zerop (nth 1 a))
X***************
X*** 2483,2488 ****
X--- 2591,2599 ----
X  		      (memq (nth 1 a) '(0 1))))))
X      (> a 0))
X  )
X+ 
X+ ;;;; [calc-macs.el]
X+ 
X  (defmacro Math-posp (a)
X    (` (if (consp (, a))
X  	 (or (eq (car (, a)) 'bigpos)
X***************
X*** 2493,2516 ****
X         (> (, a) 0)))
X  )
X  
X! ;;; True if A is a small or big integer.  [P x] [Public]
X! (defun math-integerp (a)
X!   (or (integerp a)
X!       (memq (car-safe a) '(bigpos bigneg)))
X! )
X  (defmacro Math-integerp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg))))
X  )
X  
X  (fset 'math-fixnump (symbol-function 'integerp))
X  (fset 'math-fixnatnump (symbol-function 'natnump))
X  
X! ;;; True if A is (numerically) a non-negative integer.  [P N] [Public]
X! (defun math-natnump (a)
X!   (or (natnump a)
X!       (eq (car-safe a) 'bigpos))
X! )
X  (defmacro Math-natnump (a)
X    (` (if (consp (, a))
X  	 (eq (car (, a)) 'bigpos)
X--- 2604,2622 ----
X         (> (, a) 0)))
X  )
X  
X! 
X  (defmacro Math-integerp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg))))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  (fset 'math-fixnump (symbol-function 'integerp))
X  (fset 'math-fixnatnump (symbol-function 'natnump))
X  
X! ;;;; [calc-macs.el]
X! 
X  (defmacro Math-natnump (a)
X    (` (if (consp (, a))
X  	 (eq (car (, a)) 'bigpos)
X***************
X*** 2517,2552 ****
X         (>= (, a) 0)))
X  )
X  
X- ;;; True if A is a rational (or integer).  [P x] [Public]
X- (defun math-ratp (a)
X-   (or (integerp a)
X-       (memq (car-safe a) '(bigpos bigneg frac)))
X- )
X  (defmacro Math-ratp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac))))
X  )
X  
X- ;;; True if A is a real (or rational).  [P x] [Public]
X- (defun math-realp (a)
X-   (or (integerp a)
X-       (memq (car-safe a) '(bigpos bigneg frac float)))
X- )
X  (defmacro Math-realp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac float))))
X  )
X  
X- ;;; True if A is a real or HMS form.  [P x] [Public]
X- (defun math-anglep (a)
X-   (or (integerp a)
X-       (memq (car-safe a) '(bigpos bigneg frac float hms)))
X- )
X  (defmacro Math-anglep (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac float hms))))
X  )
X  
X  ;;; True if A is a floating-point real or complex number.  [P x] [Public]
X  (defun math-floatp (a)
X    (or (eq (car-safe a) 'float)
X--- 2623,2645 ----
X         (>= (, a) 0)))
X  )
X  
X  (defmacro Math-ratp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac))))
X  )
X  
X  (defmacro Math-realp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac float))))
X  )
X  
X  (defmacro Math-anglep (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac float hms))))
X  )
X  
X+ ;;;; [calc.el]
X+ 
X  ;;; True if A is a floating-point real or complex number.  [P x] [Public]
X  (defun math-floatp (a)
X    (or (eq (car-safe a) 'float)
X***************
X*** 2556,2601 ****
X  	       (and (eq (car a) 'intv) (math-floatp (nth 3 a))))))
X  )
X  
X! ;;; True if A is a number of any kind.  [P x] [Public]
X! (defun math-numberp (a)
X!   (or (integerp a)
X!       (memq (car-safe a) '(bigpos bigneg frac float cplx polar)))
X! )
X  (defmacro Math-numberp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac float cplx polar))))
X  )
X  
X- ;;; True if A is a complex number or angle.  [P x] [Public]
X- (defun math-scalarp (a)
X-   (or (integerp a)
X-       (memq (car-safe a) '(bigpos bigneg frac float cplx polar hms)))
X- )
X  (defmacro Math-scalarp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac float cplx polar hms))))
X  )
X  
X- ;;; True if A is a vector.  [P x] [Public]
X- (defun math-vectorp (a)
X-   (eq (car-safe a) 'vec)
X- )
X  (defmacro Math-vectorp (a)
X    (` (and (consp (, a)) (eq (car (, a)) 'vec)))
X  )
X  
X- ;;; True if A is a number or a vector.  [P x] [Public]
X- (defun math-numvecp (a)
X-   (or (Math-numberp a)
X-       (Math-vectorp a))
X- )
X- 
X- ;;; True if A is numerically (but not literally) an integer.  [P x] [Public]
X- (defun math-messy-integerp (a)
X-   (cond
X-    ((eq (car-safe a) 'float) (>= (nth 2 a) 0))
X-    ((eq (car-safe a) 'frac) (Math-integerp (math-normalize a))))
X- )
X  (defmacro Math-messy-integerp (a)
X    (` (and (consp (, a))
X  	  (eq (car (, a)) 'float)
X--- 2649,2670 ----
X  	       (and (eq (car a) 'intv) (math-floatp (nth 3 a))))))
X  )
X  
X! ;;;; [calc-macs.el]
X! 
X  (defmacro Math-numberp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac float cplx polar))))
X  )
X  
X  (defmacro Math-scalarp (a)
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a)) '(bigpos bigneg frac float cplx polar hms))))
X  )
X  
X  (defmacro Math-vectorp (a)
X    (` (and (consp (, a)) (eq (car (, a)) 'vec)))
X  )
X  
X  (defmacro Math-messy-integerp (a)
X    (` (and (consp (, a))
X  	  (eq (car (, a)) 'float)
X***************
X*** 2602,2625 ****
X  	  (>= (nth 2 (, a)) 0)))
X  )
X  
X- ;;; True if A is any scalar data object.  [P x]
X- (defun math-objectp (a)    ;  [Public]
X-   (or (integerp a)
X-       (memq (car-safe a) '(bigpos bigneg frac float cplx
X- 				  polar hms sdev intv mod)))
X- )
X- (defmacro Math-objectp (a)    ;  [Public]
X-   (` (or (not (consp (, a)))
X- 	 (memq (car (, a))
X- 	       '(bigpos bigneg frac float cplx polar hms sdev intv mod))))
X- )
X- 
X- ;;; True if A is any vector or scalar data object.  [P x]
X- (defun math-objvecp (a)    ;  [Public]
X-   (or (integerp a)
X-       (memq (car-safe a) '(bigpos bigneg frac float cplx polar
X- 				  hms sdev intv mod vec incomplete)))
X- )
X  (defmacro Math-objvecp (a)    ;  [Public]
X    (` (or (not (consp (, a)))
X  	 (memq (car (, a))
X--- 2671,2676 ----
X***************
X*** 2627,2632 ****
X--- 2678,2685 ----
X  )
X  
X  
X+ ;;;; [calc-misc.el]
X+ 
X  ;;; True if A is an even integer.  [P R R] [Public]
X  (defun math-evenp (a)
X    (if (consp a)
X***************
X*** 2652,2673 ****
X      (list (/ (car a) 2)))
X  )
X  
X  
X  ;;; Verify that A is a complete object and return A.  [x x] [Public]
X  (defun math-check-complete (a)
X    (cond ((integerp a) a)
X  	((eq (car-safe a) 'incomplete)
X! 	 (cond ((memq (nth 1 a) '(cplx polar))
X! 		(error "Complex number is incomplete"))
X! 	       ((eq (nth 1 a) 'vec)
X! 		(error "Vector is incomplete"))
X! 	       ((eq (nth 1 a) 'intv)
X! 		(error "Interval form is incomplete"))
X! 	       (t (error "Object is incomplete"))))
X  	((consp a) a)
X  	(t (error "Invalid data object encountered")))
X  )
X  
X  ;;; Reject an argument to a calculator function.  [Public]
X  (defun math-reject-arg (&optional a p)
X    (calc-record-why p a)
X--- 2705,2724 ----
X      (list (/ (car a) 2)))
X  )
X  
X+ ;;;; [calc.el]
X+ 
X  
X  ;;; Verify that A is a complete object and return A.  [x x] [Public]
X  (defun math-check-complete (a)
X    (cond ((integerp a) a)
X  	((eq (car-safe a) 'incomplete)
X! 	 (calc-incomplete-error a))
X  	((consp a) a)
X  	(t (error "Invalid data object encountered")))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  ;;; Reject an argument to a calculator function.  [Public]
X  (defun math-reject-arg (&optional a p)
X    (calc-record-why p a)
X***************
X*** 2681,2687 ****
X  	((Math-looks-negp a)
X  	 (math-neg (math-trunc (math-neg a))))
X  	((eq (car a) 'float) (math-scale-int (nth 1 a) (nth 2 a)))
X- 	((eq (car a) 'frac) (math-quotient (nth 1 a) (nth 2 a)))
X  	(t (calc-extensions)
X  	   (math-trunc-fancy a)))
X  )
X--- 2732,2737 ----
X***************
X*** 2700,2705 ****
X--- 2750,2757 ----
X  )
X  (fset 'calcFunc-floor (symbol-function 'math-floor))
X  
X+ ;;;; [calc.el]
X+ 
X  
X  ;;; Coerce integer A to be a bignum.  [B S]
X  (defun math-bignum (a)
X***************
X*** 2715,2737 ****
X  )
X  
X  
X- ;;; Build a normalized fraction.  [R I I]
X- ;;; (This could probably be implemented more efficiently than using
X- ;;;  the plain gcd algorithm.)
X- (defun math-make-frac (num den)
X-   (if (Math-integer-negp den)
X-       (setq num (math-neg num)
X- 	    den (math-neg den)))
X-   (let ((gcd (math-gcd num den)))
X-     (if (eq gcd 1)
X- 	(if (eq den 1)
X- 	    num
X- 	  (list 'frac num den))
X-       (if (equal gcd den)
X- 	  (math-quotient num gcd)
X- 	(list 'frac (math-quotient num gcd) (math-quotient den gcd)))))
X- )
X- 
X  ;;; Build a normalized floating-point number.  [F I S]
X  (defun math-make-float (mant exp)
X    (if (eq mant 0)
X--- 2767,2772 ----
X***************
X*** 2769,2780 ****
X    (cond ((Math-integerp a) (math-make-float a 0))
X  	((eq (car a) 'frac) (math-div (math-float (nth 1 a)) (nth 2 a)))
X  	((eq (car a) 'float) a)
X! 	((memq (car a) '(cplx polar vec hms sdev intv mod))
X  	 (cons (car a) (mapcar 'math-float (cdr a))))
X  	(t (math-reject-arg a 'objectp)))
X  )
X  (fset 'calcFunc-float (symbol-function 'math-float))
X  
X  
X  ;;; Compute the negative of A.  [O O; o o] [Public]
X  (defmacro Math-integer-neg (a)
X--- 2804,2818 ----
X    (cond ((Math-integerp a) (math-make-float a 0))
X  	((eq (car a) 'frac) (math-div (math-float (nth 1 a)) (nth 2 a)))
X  	((eq (car a) 'float) a)
X! 	((memq (car a) '(cplx polar vec hms sdev mod))
X  	 (cons (car a) (mapcar 'math-float (cdr a))))
X+ 	((eq (car a) 'intv)
X+ 	 (cons (car a) (cons (nth 1 a) (mapcar 'math-float (nthcdr 2 a)))))
X  	(t (math-reject-arg a 'objectp)))
X  )
X  (fset 'calcFunc-float (symbol-function 'math-float))
X  
X+ ;;;; [calc-macs.el]
X  
X  ;;; Compute the negative of A.  [O O; o o] [Public]
X  (defmacro Math-integer-neg (a)
X***************
X*** 2784,2789 ****
X--- 2822,2830 ----
X  	   (cons 'bigpos (cdr (, a))))
X         (- (, a))))
X  )
X+ 
X+ ;;;; [calc.el]
X+ 
X  (defun math-neg (a)
X    (cond ((not (consp a)) (- a))
X  	((eq (car a) 'bigpos) (cons 'bigneg (cdr a)))
X***************
X*** 2794,2804 ****
X--- 2835,2850 ----
X  	 (cons (car a) (mapcar 'math-neg (cdr a))))
X  	(t (math-neg-fancy a)))
X  )
X+ 
X+ ;;;; [calc-misc.el]
X+ 
X  (defun calcFunc-neg (a)
X    (math-normalize (list 'neg a))
X  )
X  
X+ ;;;; [calc.el]
X  
X+ 
X  ;;; Compute the number of decimal digits in integer A.  [S I]
X  (defun math-numdigs (a)
X    (if (consp a)
X***************
X*** 2943,2959 ****
X  			   (cons 'bigpos diff))))
X  		    (cons 'bigpos (math-add-bignum (cdr a) (cdr b)))))))
X  	 (and (Math-ratp a) (Math-ratp b)
X! 	      (if (eq (car-safe a) 'frac)
X! 		  (if (eq (car-safe b) 'frac)
X! 		      (math-make-frac (math-add (math-mul (nth 1 a) (nth 2 b))
X! 						(math-mul (nth 2 a) (nth 1 b)))
X! 				      (math-mul (nth 2 a) (nth 2 b)))
X! 		    (math-make-frac (math-add (nth 1 a)
X! 					      (math-mul (nth 2 a) b))
X! 				    (nth 2 a)))
X! 		(math-make-frac (math-add (math-mul a (nth 2 b))
X! 					  (nth 1 b))
X! 				(nth 2 b))))
X  	 (and (Math-realp a) (Math-realp b)
X  	      (progn
X  		(or (and (consp a) (eq (car a) 'float))
X--- 2989,2996 ----
X  			   (cons 'bigpos diff))))
X  		    (cons 'bigpos (math-add-bignum (cdr a) (cdr b)))))))
X  	 (and (Math-ratp a) (Math-ratp b)
X! 	      (calc-extensions)
X! 	      (calc-add-fractions a b))
X  	 (and (Math-realp a) (Math-realp b)
X  	      (progn
X  		(or (and (consp a) (eq (car a) 'float))
X***************
X*** 2966,2971 ****
X--- 3003,3011 ----
X     (and (calc-extensions)
X  	(math-add-symb-fancy a b)))
X  )
X+ 
X+ ;;;; [calc-misc.el]
X+ 
X  (defun calcFunc-add (&rest rest)
X    (if rest
X        (let ((a (car rest)))
X***************
X*** 2975,2980 ****
X--- 3015,3022 ----
X      0)
X  )
X  
X+ ;;;; [calc.el]
X+ 
X  (defun math-add-bignum (a b)   ; [L L L; l l l]
X    (if a
X        (if b
X***************
X*** 3074,3079 ****
X--- 3116,3124 ----
X  	(math-bignum a)
X        a))
X  )
X+ 
X+ ;;;; [calc-misc.el]
X+ 
X  (defun calcFunc-sub (&rest rest)
X    (if rest
X        (let ((a (car rest)))
X***************
X*** 3083,3088 ****
X--- 3128,3135 ----
X      0)
X  )
X  
X+ ;;;; [calc.el]
X+ 
X  (defun math-sub-float (a b)   ; [F F F]
X    (let ((ediff (- (nth 2 a) (nth 2 b))))
X      (if (>= ediff 0)
X***************
X*** 3125,3138 ****
X  			     (math-mul-bignum-digit (cdr a) (nth 1 b) 0))
X  			 (math-mul-bignum-digit (cdr b) (nth 1 a) 0))))))
X  	 (and (Math-ratp a) (Math-ratp b)
X! 	      (if (eq (car-safe a) 'frac)
X! 		  (if (eq (car-safe b) 'frac)
X! 		      (math-make-frac (math-mul (nth 1 a) (nth 1 b))
X! 				      (math-mul (nth 2 a) (nth 2 b)))
X! 		    (math-make-frac (math-mul (nth 1 a) b)
X! 				    (nth 2 a)))
X! 		(math-make-frac (math-mul a (nth 1 b))
X! 				(nth 2 b))))
X  	 (and (Math-realp a) (Math-realp b)
X  	      (progn
X  		(or (and (consp a) (eq (car a) 'float))
X--- 3172,3179 ----
X  			     (math-mul-bignum-digit (cdr a) (nth 1 b) 0))
X  			 (math-mul-bignum-digit (cdr b) (nth 1 a) 0))))))
X  	 (and (Math-ratp a) (Math-ratp b)
X! 	      (calc-extensions)
X! 	      (calc-mul-fractions a b))
X  	 (and (Math-realp a) (Math-realp b)
X  	      (progn
X  		(or (and (consp a) (eq (car a) 'float))
X***************
X*** 3147,3152 ****
X--- 3188,3195 ----
X  	(math-mul-symb-fancy a b)))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  (defun calcFunc-mul (&rest rest)
X    (if rest
X        (let ((a (car rest)))
X***************
X*** 3156,3161 ****
X--- 3199,3206 ----
X      1)
X  )
X  
X+ ;;;; [calc.el]
X+ 
X  ;;; Multiply digit lists A and B.  [L L L; l l l]
X  (defun math-mul-bignum (a b)
X    (and a b
X***************
X*** 3202,3207 ****
X--- 3247,3254 ----
X  )
X  
X  
X+ ;;;; [calc-misc.el]
X+ 
X  ;;; Compute the square of A.  [O O] [Public]
X  (defun math-sqr (a)
X    (if (eq (car-safe a) 'calcFunc-sqrt)
X***************
X*** 3209,3215 ****
X--- 3256,3264 ----
X      (math-mul a a))
X  )
X  
X+ ;;;; [calc.el]
X  
X+ 
X  ;;; Compute the integer (quotient . remainder) of A and B, which may be
X  ;;; small or big integers.  Type and consistency of truncation is undefined
X  ;;; if A or B is negative.  B must be nonzero.  [I.I I I] [Public]
X***************
X*** 3254,3259 ****
X--- 3303,3310 ----
X  			      (car res))))))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  (defun math-imod (a b)   ; [I I I] [Public]
X    (if (and (not (consp a)) (not (consp b)))
X        (if (= b 0)
X***************
X*** 3262,3267 ****
X--- 3313,3320 ----
X      (cdr (math-idivmod a b)))
X  )
X  
X+ ;;;; [calc.el]
X+ 
X  ;;; Divide a bignum digit list by another.  [l.l l L]
X  ;;; The following division algorithm is borrowed from Knuth vol. II, sec. 4.3.1
X  (defun math-div-bignum (a b)
X***************
X*** 3327,3348 ****
X     (and (Math-objvecp a) (Math-objvecp b)
X  	(or
X  	 (and (Math-integerp a) (Math-integerp b)
X! 	      (if calc-prefer-frac
X! 		  (math-make-frac a b)
X! 		(let ((q (math-idivmod a b)))
X! 		  (if (eq (cdr q) 0)
X! 		      (car q)
X  		    (math-div-float (math-make-float a 0)
X  				    (math-make-float b 0))))))
X  	 (and (Math-ratp a) (Math-ratp b)
X! 	      (if (eq (car-safe a) 'frac)
X! 		  (if (eq (car-safe b) 'frac)
X! 		      (math-make-frac (math-mul (nth 1 a) (nth 2 b))
X! 				      (math-mul (nth 2 a) (nth 1 b)))
X! 		    (math-make-frac (nth 1 a)
X! 				    (math-mul (nth 2 a) b)))
X! 		(math-make-frac (math-mul a (nth 2 b))
X! 				(nth 1 b))))
X  	 (and (Math-realp a) (Math-realp b)
X  	      (progn
X  		(or (and (consp a) (eq (car a) 'float))
X--- 3380,3397 ----
X     (and (Math-objvecp a) (Math-objvecp b)
X  	(or
X  	 (and (Math-integerp a) (Math-integerp b)
X! 	      (let ((q (math-idivmod a b)))
X! 		(if (eq (cdr q) 0)
X! 		    (car q)
X! 		  (if calc-prefer-frac
X! 		      (progn
X! 			(calc-extensions)
X! 			(math-make-frac a b))
X  		    (math-div-float (math-make-float a 0)
X  				    (math-make-float b 0))))))
X  	 (and (Math-ratp a) (Math-ratp b)
X! 	      (calc-extensions)
X! 	      (calc-div-fractions a b))
X  	 (and (Math-realp a) (Math-realp b)
X  	      (progn
X  		(or (and (consp a) (eq (car a) 'float))
X***************
X*** 3355,3360 ****
X--- 3404,3412 ----
X     (and (calc-extensions)
X  	(math-div-symb-fancy a b)))
X  )
X+ 
X+ ;;;; [calc-misc.el]
X+ 
X  (defun calcFunc-div (a &rest rest)
X    (while rest
X      (setq a (list '/ a (car rest))
X***************
X*** 3362,3367 ****
X--- 3414,3421 ----
X    (math-normalize a)
X  )
X  
X+ ;;;; [calc.el]
X+ 
X  (defun math-div-float (a b)   ; [F F F]
X    (let ((ldiff (max (- (1+ calc-internal-prec)
X  		       (- (math-numdigs (nth 1 a)) (math-numdigs (nth 1 b))))
X***************
X*** 3370,3375 ****
X--- 3424,3431 ----
X  		     (- (- (nth 2 a) (nth 2 b)) ldiff)))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  (defun math-inv (m)
X    (if (Math-vectorp m)
X        (progn
X***************
X*** 3383,3388 ****
X--- 3439,3446 ----
X  (fset 'calcFunc-inv (symbol-function 'math-inv))
X  
X  
X+ ;;;; [calc-macs.el]
X+ 
X  (defmacro math-working (msg arg)    ; [Public]
X    (` (if (eq calc-display-working-message 'lots)
X  	 (progn
X***************
X*** 3394,3402 ****
X  )
X  
X  
X  ;;; Compute A modulo B, defined in terms of truncation toward minus infinity.
X  (defun math-mod (a b)   ; [R R R] [Public]
X!   (cond ((Math-zerop a) a)
X  	((Math-zerop b)
X  	 (math-reject-arg a "Division by zero"))
X  	((and (Math-natnump a) (Math-natnump b))
X--- 3452,3462 ----
X  )
X  
X  
X+ ;;;; [calc-misc.el]
X+ 
X  ;;; Compute A modulo B, defined in terms of truncation toward minus infinity.
X  (defun math-mod (a b)   ; [R R R] [Public]
X!   (cond ((and (Math-zerop a) (not (eq (car-safe a) 'mod))) a)
X  	((Math-zerop b)
X  	 (math-reject-arg a "Division by zero"))
X  	((and (Math-natnump a) (Math-natnump b))
X***************
X*** 3403,3417 ****
X  	 (math-imod a b))
X  	((and (Math-anglep a) (Math-anglep b))
X  	 (math-sub a (math-mul (math-floor (math-div a b)) b)))
X! 	((and (eq (car-safe a) 'mod) (Math-realp b) (math-posp b))
X! 	 (math-make-mod (nth 1 a) b))
X! 	((and (eq (car-safe a) 'intv) (math-constp a) (math-posp b))
X! 	 (math-mod-intv a b))
X! 	(t
X! 	 (if (Math-anglep a)
X! 	     (calc-record-why 'anglep b)
X! 	   (calc-record-why 'anglep a))
X! 	 (list '% a b)))
X  )
X  (defun calcFunc-mod (a b)
X    (math-normalize (list '% a b))
X--- 3463,3470 ----
X  	 (math-imod a b))
X  	((and (Math-anglep a) (Math-anglep b))
X  	 (math-sub a (math-mul (math-floor (math-div a b)) b)))
X! 	(t (calc-extensions)
X! 	   (math-mod-fancy a b)))
X  )
X  (defun calcFunc-mod (a b)
X    (math-normalize (list '% a b))
X***************
X*** 3468,3474 ****
X  
X  (defun math-pow (a b)   ; [O O N] [Public]
X    (cond ((Math-zerop a)
X! 	 (if (math-zerop b)
X  	     (math-reject-arg (list '^ a b) "Indeterminate form")
X  	   (if (math-floatp b) (math-float a) a)))
X  	((or (eq a 1) (eq b 1)) a)
X--- 3521,3527 ----
X  
X  (defun math-pow (a b)   ; [O O N] [Public]
X    (cond ((Math-zerop a)
X! 	 (if (Math-zerop b)
X  	     (math-reject-arg (list '^ a b) "Indeterminate form")
X  	   (if (math-floatp b) (math-float a) a)))
X  	((or (eq a 1) (eq b 1)) a)
X***************
X*** 3476,3484 ****
X  	((Math-zerop b)
X  	 (if (eq (car-safe a) 'mod)
X  	     (math-make-mod 1 (nth 2 a))
X! 	   (if (or (math-floatp a) (math-floatp b))
X! 	       '(float 1 0) 1)))
X! 	((and (Math-integerp b) (math-numvecp a))
X  	 (math-with-extra-prec 2
X  	   (math-ipow a b)))
X  	(t
X--- 3529,3539 ----
X  	((Math-zerop b)
X  	 (if (eq (car-safe a) 'mod)
X  	     (math-make-mod 1 (nth 2 a))
X! 	   (if (math-matrixp a)
X! 	       (math-diag-matrix 1 (1- (length a)))
X! 	     (if (or (math-floatp a) (math-floatp b))
X! 		 '(float 1 0) 1))))
X! 	((and (Math-integerp b) (or (Math-numberp a) (Math-vectorp a)))
X  	 (math-with-extra-prec 2
X  	   (math-ipow a b)))
X  	(t
X***************
X*** 3521,3526 ****
X--- 3576,3582 ----
X      val)
X  )
X  
X+ ;;;; [calc.el]
X  
X  
X  
X***************
X*** 3527,3544 ****
X  
X  ;;; Format the number A as a string.  [X N; X Z] [Public]
X  ;;; Target line-width is W.
X! (defun math-format-stack-value (a &optional w)
X    (or w (setq w (calc-window-width)))
X!   (let ((c (cond ((null a) "<nil>")
X! 		 ((eq calc-display-raw t) (format "%s" a))
X! 		 ((stringp a) a)
X! 		 ((eq a 'top-of-stack) ".")
X! 		 ((and (math-scalarp a)
X! 		       (memq calc-language '(nil flat unform)))
X! 		  (math-format-number a))
X! 		 (t (calc-extensions)
X! 		    (math-compose-expr a 0))))
X! 	s ww)
X      (if (and calc-display-just
X  	     (< (setq ww (if (stringp c)
X  			     (length c)
X--- 3583,3607 ----
X  
X  ;;; Format the number A as a string.  [X N; X Z] [Public]
X  ;;; Target line-width is W.
X! (defun math-format-stack-value (entry &optional w)
X    (or w (setq w (calc-window-width)))
X!   (setq calc-selection-cache-entry calc-selection-cache-default-entry)
X!   (let* ((a (car entry))
X! 	 (math-comp-selected (nth 2 entry))
X! 	 (c (cond ((null a) "<nil>")
X! 		  ((eq calc-display-raw t) (format "%s" a))
X! 		  ((stringp a) a)
X! 		  ((eq a 'top-of-stack) ".")
X! 		  (calc-prepared-composition
X! 		   calc-prepared-composition)
X! 		  ((and (Math-scalarp a)
X! 			(memq calc-language '(nil flat unform))
X! 			(null math-comp-selected))
X! 		   (math-format-number a))
X! 		  (t (calc-extensions)
X! 		     (math-compose-expr a 0))))
X! 	 s ww)
X!     (and math-comp-selected (setq calc-any-selections t))
X      (if (and calc-display-just
X  	     (< (setq ww (if (stringp c)
X  			     (length c)
X***************
X*** 3550,3574 ****
X  		 c))
X        (if calc-line-numbering
X  	  (setq c (math-comp-concat
X! 		   (if (eq calc-language 'big) "1:  " "    ") c))))
X!     (let ((s (if (stringp c)
X! 		 (if calc-display-raw
X! 		     (prin1-to-string c)
X! 		   c)
X! 	       (math-composition-to-string c w))))
X!       (if calc-language-output-filter
X! 	  (setq s (funcall calc-language-output-filter s)))
X!       (if (eq calc-language 'big)
X! 	  (concat s "\n")
X! 	(if calc-line-numbering
X! 	    (progn
X! 	      (aset s 0 ?1)
X! 	      (aset s 1 ?:)))
X! 	s)))
X  )
X  
X  (defun math-format-value (a &optional w)
X!   (if (and (math-scalarp a)
X  	   (memq calc-language '(nil flat unform)))
X        (math-format-number a)
X      (calc-extensions)
X--- 3613,3649 ----
X  		 c))
X        (if calc-line-numbering
X  	  (setq c (math-comp-concat
X! 		   (if (eq calc-language 'big)
X! 		       (if math-comp-selected '(tag t "1:  ") "1:  ")
X! 		     "    ") c))))
X!     (setq s (if (stringp c)
X! 		(if calc-display-raw
X! 		    (prin1-to-string c)
X! 		  c)
X! 	      (math-composition-to-string c w)))
X!     (if calc-language-output-filter
X! 	(setq s (funcall calc-language-output-filter s)))
X!     (if (eq calc-language 'big)
X! 	(setq s (concat s "\n"))
X!       (if calc-line-numbering
X! 	  (progn
X! 	    (aset s 0 ?1)
X! 	    (aset s 1 ?:))))
X!     (setcar (cdr entry) (calc-count-lines s))
X!     s)
X! )
X! 
X! (defun calc-count-lines (s)
X!   (let ((pos 0)
X! 	(num 1))
X!     (while (setq newpos (string-match "\n" s pos))
X!       (setq pos (1+ newpos)
X! 	    num (1+ num)))
X!     num)
X  )
X  
X  (defun math-format-value (a &optional w)
X!   (if (and (Math-scalarp a)
X  	   (memq calc-language '(nil flat unform)))
X        (math-format-number a)
X      (calc-extensions)
X***************
X*** 3595,3601 ****
X  	(eq calc-display-raw t))
X      (let ((print-escape-newlines t))
X        (concat "'" (prin1-to-string a))))
X!    ((math-scalarp a)
X      (let ((calc-group-digits nil)
X  	  (calc-point-char ".")
X  	  (calc-frac-format (if (> (length calc-frac-format) 1) "::" ":"))
X--- 3670,3676 ----
X  	(eq calc-display-raw t))
X      (let ((print-escape-newlines t))
X        (concat "'" (prin1-to-string a))))
X!    ((Math-scalarp a)
X      (let ((calc-group-digits nil)
X  	  (calc-point-char ".")
X  	  (calc-frac-format (if (> (length calc-frac-format) 1) "::" ":"))
X***************
X*** 3637,3658 ****
X     ((stringp a) a)
X     ((eq (car a) 'bigpos) (math-format-bignum (cdr a)))
X     ((eq (car a) 'bigneg) (concat "-" (math-format-bignum (cdr a))))
X-    ((eq (car a) 'frac)
X-     (if (> (length calc-frac-format) 1)
X- 	(if (Math-integer-negp (nth 1 a))
X- 	    (concat "-" (math-format-number (math-neg a)))
X- 	  (let ((q (math-idivmod (nth 1 a) (nth 2 a))))
X- 	    (concat (math-format-number (car q))
X- 		    (substring calc-frac-format 0 1)
X- 		    (let ((math-radix-explicit-format nil))
X- 		      (math-format-number (cdr q)))
X- 		    (substring calc-frac-format 1 2)
X- 		    (let ((math-radix-explicit-format nil))
X- 		      (math-format-number (nth 2 a))))))
X-       (concat (math-format-number (nth 1 a))
X- 	      calc-frac-format
X- 	      (let ((math-radix-explicit-format nil))
X- 		(math-format-number (nth 2 a))))))
X     ((eq (car a) 'float)
X      (if (Math-integer-negp (nth 1 a))
X  	(concat "-" (math-format-number (math-neg a)))
X--- 3712,3717 ----
X***************
X*** 3730,3737 ****
X      (math-format-number-fancy a)))
X  )
X  
X- (defvar math-radix-explicit-format t)
X- 
X  (defun math-format-bignum (a)   ; [X L]
X    (if (and (= calc-number-radix 10)
X  	   (not calc-leading-zeros)
X--- 3789,3794 ----
X***************
X*** 3774,3816 ****
X       (math-read-number (concat (math-match-substring s 1)
X  			       (math-match-substring s 2))))
X  
X!     ;; Minus sign
X!     ((string-match "^[-_]\\(.*\\)$" s)
X       (let ((val (math-read-number (math-match-substring s 1))))
X!        (and val (math-neg val))))
X! 
X!     ;; Plus sign
X!     ((string-match "^\\+\\(.*\\)$" s)
X!      (math-read-number (math-match-substring s 1)))
X  
X      ;; Forms that require extensions module
X!     ((string-match "[a-df-zA-DF-Z/@'\"#^]" s)
X       (calc-extensions)
X       (math-read-number-fancy s))
X  
X-     ;; Integer+fractions
X-     ((string-match "^\\(.*\\)[:/]\\(.*\\)[:/]\\(.*\\)$" s)
X-      (let ((int (math-match-substring s 1))
X- 	   (num (math-match-substring s 2))
X- 	   (den (math-match-substring s 3)))
X-        (let ((int (if (> (length int) 0) (math-read-number int) 0))
X- 	     (num (if (> (length num) 0) (math-read-number num) 1))
X- 	     (den (if (> (length num) 0) (math-read-number den) 1)))
X- 	 (and int num den
X- 	      (math-integerp int) (math-integerp num) (math-integerp den)
X- 	      (not (math-zerop den))
X- 	      (list 'frac (math-add num (math-mul int den)) den)))))
X- 
X-     ;; Fractions
X-     ((string-match "^\\(.*\\)[:/]\\(.*\\)$" s)
X-      (let ((num (math-match-substring s 1))
X- 	   (den (math-match-substring s 2)))
X-        (let ((num (if (> (length num) 0) (math-read-number num) 1))
X- 	     (den (if (> (length num) 0) (math-read-number den) 1)))
X- 	 (and num den (math-integerp num) (math-integerp den)
X- 	      (not (math-zerop den))
X- 	      (list 'frac num den)))))
X- 
X      ;; Decimal point
X      ((string-match "^\\([0-9]*\\)\\.\\([0-9]*\\)$" s)
X       (let ((int (math-match-substring s 1))
X--- 3831,3846 ----
X       (math-read-number (concat (math-match-substring s 1)
X  			       (math-match-substring s 2))))
X  
X!     ;; Plus and minus signs
X!     ((string-match "^[-_+]\\(.*\\)$" s)
X       (let ((val (math-read-number (math-match-substring s 1))))
X!        (and val (if (eq (aref s 0) ?+) val (math-neg val)))))
X  
X      ;; Forms that require extensions module
X!     ((string-match "[^-+0-9eE.]" s)
X       (calc-extensions)
X       (math-read-number-fancy s))
X  
X      ;; Decimal point
X      ((string-match "^\\([0-9]*\\)\\.\\([0-9]*\\)$" s)
X       (let ((int (math-match-substring s 1))
X***************
X*** 3830,3836 ****
X  	   (exp (math-match-substring s 2)))
X         (let ((mant (if (> (length mant) 0) (math-read-number mant) 1))
X  	     (exp (string-to-int exp)))
X! 	 (and mant (math-realp mant)
X  	      (let ((mant (math-float mant)))
X  		(list 'float (nth 1 mant) (+ (nth 2 mant) exp)))))))
X  
X--- 3860,3866 ----
X  	   (exp (math-match-substring s 2)))
X         (let ((mant (if (> (length mant) 0) (math-read-number mant) 1))
X  	     (exp (string-to-int exp)))
X! 	 (and mant (Math-realp mant)
X  	      (let ((mant (math-float mant)))
X  		(list 'float (nth 1 mant) (+ (nth 2 mant) exp)))))))
X  
X***************
X*** 3851,3856 ****
X--- 3881,3888 ----
X      (list (string-to-int s)))
X  )
X  
X+ ;;;; [calc-misc.el]
X+ 
X  (defun math-read-radix-digit (dig)   ; [D S; Z S]
X    (if (> dig ?9)
X        (if (< dig ?A)
X***************
X*** 3863,3868 ****
X--- 3895,3903 ----
X  
X  
X  
X+ 
X+ ;;;; [calc-aent.el]
X+ 
X  ;;; Algebraic expression parsing.   [Public]
X  
X  (defun math-read-exprs (exp-str)
X***************
X*** 3903,3909 ****
X  	    exp-data "\000")
X      (let ((ch (elt exp-str exp-pos)))
X        (setq exp-old-pos exp-pos)
X!       (cond ((memq ch '(32 10))
X  	     (setq exp-pos (1+ exp-pos))
X  	     (if exp-keep-spaces
X  		 (setq exp-token 'space
X--- 3938,3944 ----
X  	    exp-data "\000")
X      (let ((ch (elt exp-str exp-pos)))
X        (setq exp-old-pos exp-pos)
X!       (cond ((memq ch '(32 10 9))
X  	     (setq exp-pos (1+ exp-pos))
X  	     (if exp-keep-spaces
X  		 (setq exp-token 'space
X***************
X*** 3954,3972 ****
X  		   exp-pos (match-end 0)
X  		   exp-data (math-restore-dashes
X  			     (math-match-substring exp-str 1)))
X! 	     (if (or (equal exp-data "\\left")
X! 		     (equal exp-data "\\right"))
X! 		 (math-read-token)))
X  	    (t
X  	     (if (and (eq ch ?\{) (eq calc-language 'tex))
X  		 (setq ch ?\())
X  	     (if (and (eq ch ?\}) (eq calc-language 'tex))
X  		 (setq ch ?\)))
X  	     (setq exp-token 'punc
X  		   exp-data (char-to-string ch)
X  		   exp-pos (1+ exp-pos))))))
X  )
X  
X  (defconst math-standard-opers
X    '( ( "u+"    ident	     -1 1000 )
X       ( "u-"    neg	     -1 1000 )
X--- 3989,4038 ----
X  		   exp-pos (match-end 0)
X  		   exp-data (math-restore-dashes
X  			     (math-match-substring exp-str 1)))
X! 	     (let ((code (assoc exp-data math-tex-ignore-words)))
X! 	       (cond ((null code))
X! 		     ((null (cdr code))
X! 		      (math-read-token))
X! 		     ((eq (nth 1 code) 'punc)
X! 		      (setq exp-token 'punc
X! 			    exp-data (nth 2 code)))
X! 		     ((and (eq (nth 1 code) 'mat)
X! 			   (string-match " *{" exp-str exp-pos))
X! 		      (setq exp-pos (match-end 0)
X! 			    exp-token 'punc
X! 			    exp-data "[")
X! 		      (let ((right (string-match "}" exp-str exp-pos)))
X! 			(and right
X! 			     (setq exp-str (copy-sequence exp-str))
X! 			     (aset exp-str right ?\])))))))
X  	    (t
X  	     (if (and (eq ch ?\{) (eq calc-language 'tex))
X  		 (setq ch ?\())
X  	     (if (and (eq ch ?\}) (eq calc-language 'tex))
X  		 (setq ch ?\)))
X+ 	     (if (and (eq ch ?\&) (eq calc-language 'tex))
X+ 		 (setq ch ?\,))
X  	     (setq exp-token 'punc
X  		   exp-data (char-to-string ch)
X  		   exp-pos (1+ exp-pos))))))
X  )
X  
X+ ;;;; [calc.el]
X+ 
X+ (defconst math-tex-ignore-words
X+   '( ("\\hbox") ("\\mbox") ("\\text") ("\\left") ("\\right")
X+      ("\\,") ("\\>") ("\\:") ("\\;") ("\\!") ("\\ ")
X+      ("\\quad") ("\\qquad") ("\\hfil") ("\\hfill")
X+      ("\\displaystyle") ("\\textstyle") ("\\dsize") ("\\tsize")
X+      ("\\scriptstyle") ("\\scriptscriptstyle") ("\\ssize") ("\\sssize")
X+      ("\\rm") ("\\bf") ("\\it") ("\\sl")
X+      ("\\roman") ("\\bold") ("\\italic") ("\\slanted")
X+      ("\\cal") ("\\mit") ("\\Cal") ("\\Bbb") ("\\frak") ("\\goth")
X+      ("\\matrix" mat) ("\\bmatrix" mat) ("\\pmatrix" mat)
X+      ("\\cr" punc ";") ("\\\\" punc ";") ("\\*" punc "*")
X+      ("\\{" punc "[") ("\\}" punc "]")
X+ ))
X+ 
X  (defconst math-standard-opers
X    '( ( "u+"    ident	     -1 1000 )
X       ( "u-"    neg	     -1 1000 )
X***************
X*** 3995,4003 ****
X       ( "?"     calcFunc-if    91  90 )
X  ))
X  (setq math-expr-opers math-standard-opers)
X- (setq math-expr-function-mapping nil)
X- (setq math-expr-variable-mapping nil)
X  
X  (defun math-read-expr-level (exp-prec)
X    (let* ((x (math-read-factor)) op)
X      (while (and (or (and (setq op (assoc exp-data math-expr-opers))
X--- 4061,4069 ----
X       ( "?"     calcFunc-if    91  90 )
X  ))
X  (setq math-expr-opers math-standard-opers)
X  
X+ ;;;; [calc-aent.el]
X+ 
X  (defun math-read-expr-level (exp-prec)
X    (let* ((x (math-read-factor)) op)
X      (while (and (or (and (setq op (assoc exp-data math-expr-opers))
X***************
X*** 4073,4079 ****
X  	   (let ((val (math-read-expr-level (nth 3 op))))
X  	     (cond ((eq (nth 1 op) 'ident)
X  		    val)
X! 		   ((and (math-numberp val)
X  			 (equal (car op) "u-"))
X  		    (math-neg val))
X  		   (t (list (nth 1 op) val)))))
X--- 4139,4145 ----
X  	   (let ((val (math-read-expr-level (nth 3 op))))
X  	     (cond ((eq (nth 1 op) 'ident)
X  		    val)
X! 		   ((and (Math-numberp val)
X  			 (equal (car op) "u-"))
X  		    (math-neg val))
X  		   (t (list (nth 1 op) val)))))
X***************
X*** 4140,4146 ****
X  		   (math-read-token)
X  		   (let ((exp2 (math-read-expr-level 0)))
X  		     (setq exp
X! 			   (if (and exp2 (math-realp exp) (math-realp exp2))
X  			       (math-normalize (list 'cplx exp exp2))
X  			     (list '+ exp (list '* exp2 '(var i var-i))))))))
X  		((equal exp-data ";")
X--- 4206,4212 ----
X  		   (math-read-token)
X  		   (let ((exp2 (math-read-expr-level 0)))
X  		     (setq exp
X! 			   (if (and exp2 (Math-realp exp) (Math-realp exp2))
X  			       (math-normalize (list 'cplx exp exp2))
X  			     (list '+ exp (list '* exp2 '(var i var-i))))))))
X  		((equal exp-data ";")
X***************
X*** 4147,4154 ****
X  		 (progn
X  		   (math-read-token)
X  		   (let ((exp2 (math-read-expr-level 0)))
X! 		     (setq exp (if (and exp2 (math-realp exp)
X! 					(math-anglep exp2))
X  				   (math-normalize (list 'polar exp exp2))
X  				 (list '* exp
X  				       (list 'calcFunc-exp
X--- 4213,4220 ----
X  		 (progn
X  		   (math-read-token)
X  		   (let ((exp2 (math-read-expr-level 0)))
X! 		     (setq exp (if (and exp2 (Math-realp exp)
X! 					(Math-anglep exp2))
X  				   (math-normalize (list 'polar exp exp2))
X  				 (list '* exp
X  				       (list 'calcFunc-exp
X***************
X*** 4181,4190 ****
X  	  (t (throw 'syntax "Expected a number"))))
X  )
X  
X- (defvar math-read-expr-quotes nil)
X  
X  
X  
X  
X  ;;; Bug reporting
X  
X--- 4247,4256 ----
X  	  (t (throw 'syntax "Expected a number"))))
X  )
X  
X  
X  
X  
X+ ;;;; [calc-misc.el]
X  
X  ;;; Bug reporting
X  
X***************
X*** 4194,4203 ****
X    (interactive "sBug Subject: ")
X    (mail nil calc-bug-address topic)
X    (goto-char (point-max))
X!   (insert "\nIn Calc 1.04, Emacs " (emacs-version) "\n\n")
X    (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
X  )
X  
X  
X  
X  ;;; User-programmability.
X--- 4260,4270 ----
X    (interactive "sBug Subject: ")
X    (mail nil calc-bug-address topic)
X    (goto-char (point-max))
X!   (insert "\nIn Calc 1.05, Emacs " (emacs-version) "\n\n")
X    (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
X  )
X  
X+ ;;;; [calc.el]
X  
X  
X  ;;; User-programmability.
X***************
X*** 4211,4216 ****
X--- 4278,4311 ----
X  
X  (if calc-always-load-extensions
X      (calc-extensions)
X+ )
X+ 
X+ 
X+ 
X+ ;;;; [end]
X+ 
X+ 
X+ 
X+ (defun calc-install ()
X+   "Split \"calc.el\" and \"calc-ext.el\"; format \"calc.texinfo\".
X+ Usage, from the Unix shell:
X+        cd <Calc home directory>
X+        emacs -batch -l calc -f calc-install"
X+   (interactive)
X+   (find-file "calc-ext.el")
X+   (end-of-buffer)
X+   (backward-paragraph 2)
X+   (eval-last-sexp nil)
X+   (find-file "calc.el")
X+   (search-forward "calc-info-filename \"")
X+   (insert (file-name-directory buffer-file-name))
X+   (calc-split (file-name-directory (buffer-file-name)) nil t)
X+   (find-file "calc-ext.el")
X+   (calc-split (file-name-directory (buffer-file-name)) nil t)
X+   (byte-compile-file "macedit.el")
X+   (find-file "calc.texinfo")
X+   (texinfo-format-buffer)
X+   (save-buffer)
X  )
X  
X  
X*** calc-ext.el	Mon Aug  6 15:05:32 1990
X--- ../dist/calc-ext.el	Tue Oct  9 16:42:43 1990
X***************
X*** 1,4 ****
X! ;; Calculator for GNU Emacs version 1.04, part II
X  ;; Copyright (C) 1990 Dave Gillespie
X  
X  ;; This file is part of GNU Emacs.
X--- 1,4 ----
X! ;; Calculator for GNU Emacs version 1.05, part II
X  ;; Copyright (C) 1990 Dave Gillespie
X  
X  ;; This file is part of GNU Emacs.
X***************
X*** 40,45 ****
X--- 40,47 ----
X  ;;; do "M-x load-file calc.elc" before compiling calc-ext.el.
X  (require 'calc)  ;;; This should only occur in the byte compiler.
X  
X+ ;;; Make sure calc-macs.el is also present, in case calc.el has been split.
X+ (require (progn (and (boundp 'outbuffer) (calc-need-macros)) 'calc))
X  
X  
X  ;;; The following was made a function so that it could be byte-compiled.
X***************
X*** 49,67 ****
X    (define-key calc-mode-map "\\" 'calc-idiv)
X    (define-key calc-mode-map "|" 'calc-concat)
X    (define-key calc-mode-map "!" 'calc-factorial)
X-   (define-key calc-mode-map "A" 'calc-abs)
X-   (define-key calc-mode-map "B" 'calc-log)
X    (define-key calc-mode-map "C" 'calc-cos)
X-   (define-key calc-mode-map "D" 'calc-redo)
X    (define-key calc-mode-map "E" 'calc-exp)
X-   (define-key calc-mode-map "F" 'calc-floor)
X-   (define-key calc-mode-map "G" 'calc-argument)
X    (define-key calc-mode-map "H" 'calc-hyperbolic)
X    (define-key calc-mode-map "I" 'calc-inverse)
X    (define-key calc-mode-map "J" 'calc-conj)
X-   (define-key calc-mode-map "K" 'calc-call-last-kbd-macro)
X    (define-key calc-mode-map "L" 'calc-ln)
X-   (define-key calc-mode-map "M" 'calc-more-recursion-depth)
X    (define-key calc-mode-map "N" 'calc-eval-num)
X    (define-key calc-mode-map "P" 'calc-pi)
X    (define-key calc-mode-map "Q" 'calc-sqrt)
X--- 51,62 ----
X***************
X*** 70,79 ****
X--- 65,79 ----
X    (define-key calc-mode-map "T" 'calc-tan)
X    (define-key calc-mode-map "U" 'calc-undo)
X    (define-key calc-mode-map "X" 'calc-last-x)
X+   (define-key calc-mode-map "h" 'calc-full-help)
X    (define-key calc-mode-map "l" 'calc-let)
X+   (define-key calc-mode-map "o" 'calc-realign)
X+   (define-key calc-mode-map "p" 'calc-precision)
X    (define-key calc-mode-map "r" 'calc-recall)
X    (define-key calc-mode-map "s" 'calc-store)
X+   (define-key calc-mode-map "w" 'calc-why)
X    (define-key calc-mode-map "x" 'calc-execute-extended-command)
X+   (define-key calc-mode-map "y" 'calc-copy-to-buffer)
X  
X    (define-key calc-mode-map "(" 'calc-begin-complex)
X    (define-key calc-mode-map ")" 'calc-end-complex)
X***************
X*** 84,90 ****
X    (define-key calc-mode-map "`" 'calc-edit)
X    (define-key calc-mode-map "=" 'calc-evaluate)
X    (define-key calc-mode-map "~" 'calc-num-prefix)
X!   (define-key calc-mode-map "y" 'calc-copy-to-buffer)
X    (define-key calc-mode-map "\C-k" 'calc-kill)
X    (define-key calc-mode-map "\M-k" 'calc-copy-as-kill)
X    (define-key calc-mode-map "\C-w" 'calc-kill-region)
X--- 84,91 ----
X    (define-key calc-mode-map "`" 'calc-edit)
X    (define-key calc-mode-map "=" 'calc-evaluate)
X    (define-key calc-mode-map "~" 'calc-num-prefix)
X!   (define-key calc-mode-map "<" 'calc-scroll-left)
X!   (define-key calc-mode-map ">" 'calc-scroll-right)
X    (define-key calc-mode-map "\C-k" 'calc-kill)
X    (define-key calc-mode-map "\M-k" 'calc-copy-as-kill)
X    (define-key calc-mode-map "\C-w" 'calc-kill-region)
X***************
X*** 100,111 ****
X--- 101,118 ----
X    (define-key calc-mode-map "ad" 'calc-derivative)
X    (define-key calc-mode-map "ae" 'calc-simplify-extended)
X    (define-key calc-mode-map "ai" 'calc-integral)
X+   (define-key calc-mode-map "am" 'calc-match)
X    (define-key calc-mode-map "ar" 'calc-rewrite)
X    (define-key calc-mode-map "as" 'calc-simplify)
X    (define-key calc-mode-map "at" 'calc-taylor)
X+   (define-key calc-mode-map "av" 'calc-alg-evaluate)
X    (define-key calc-mode-map "ax" 'calc-expand)
X+   (define-key calc-mode-map "aA" 'calc-abs)
X    (define-key calc-mode-map "aI" 'calc-integral-limit)
X+   (define-key calc-mode-map "aN" 'calc-find-minimum)
X    (define-key calc-mode-map "aS" 'calc-solve-for)
X+   (define-key calc-mode-map "aR" 'calc-find-root)
X+   (define-key calc-mode-map "aX" 'calc-find-maximum)
X    (define-key calc-mode-map "a=" 'calc-equal-to)
X    (define-key calc-mode-map "a#" 'calc-not-equal-to)
X    (define-key calc-mode-map "a<" 'calc-less-than)
X***************
X*** 116,121 ****
X--- 123,129 ----
X    (define-key calc-mode-map "a&" 'calc-logical-and)
X    (define-key calc-mode-map "a|" 'calc-logical-or)
X    (define-key calc-mode-map "a!" 'calc-logical-not)
X+   (define-key calc-mode-map "a:" 'calc-logical-if)
X  
X    (define-key calc-mode-map "b" nil)
X    (define-key calc-mode-map "b?" 'calc-b-prefix-help)
X***************
X*** 131,142 ****
X    (define-key calc-mode-map "bt" 'calc-rotate-binary)
X    (define-key calc-mode-map "bw" 'calc-word-size)
X    (define-key calc-mode-map "bx" 'calc-xor)
X  
X    (define-key calc-mode-map "c" nil)
X    (define-key calc-mode-map "c?" 'calc-c-prefix-help)
X-   (define-key calc-mode-map "c1" 'calc-clean-1)
X-   (define-key calc-mode-map "c2" 'calc-clean-2)
X-   (define-key calc-mode-map "c3" 'calc-clean-3)
X    (define-key calc-mode-map "cc" 'calc-clean)
X    (define-key calc-mode-map "cd" 'calc-to-degrees)
X    (define-key calc-mode-map "cf" 'calc-float)
X--- 139,148 ----
X    (define-key calc-mode-map "bt" 'calc-rotate-binary)
X    (define-key calc-mode-map "bw" 'calc-word-size)
X    (define-key calc-mode-map "bx" 'calc-xor)
X+   (define-key calc-mode-map "bB" 'calc-log)
X  
X    (define-key calc-mode-map "c" nil)
X    (define-key calc-mode-map "c?" 'calc-c-prefix-help)
X    (define-key calc-mode-map "cc" 'calc-clean)
X    (define-key calc-mode-map "cd" 'calc-to-degrees)
X    (define-key calc-mode-map "cf" 'calc-float)
X***************
X*** 168,173 ****
X--- 174,180 ----
X    (define-key calc-mode-map "dw" 'calc-auto-why)
X    (define-key calc-mode-map "dz" 'calc-leading-zeros)
X    (define-key calc-mode-map "dB" 'calc-big-language)
X+   (define-key calc-mode-map "dD" 'calc-redo)
X    (define-key calc-mode-map "dC" 'calc-c-language)
X    (define-key calc-mode-map "dF" 'calc-fortran-language)
X    (define-key calc-mode-map "dM" 'calc-mathematica-language)
X***************
X*** 188,207 ****
X    (define-key calc-mode-map "d`" 'calc-realign)
X    (define-key calc-mode-map "d~" 'calc-refresh)
X  
X    (define-key calc-mode-map "k" nil)
X    (define-key calc-mode-map "k?" 'calc-k-prefix-help)
X    (define-key calc-mode-map "ka" 'calc-random-again)
X!   (define-key calc-mode-map "kb" 'calc-choose)
X    (define-key calc-mode-map "kd" 'calc-double-factorial)
X    (define-key calc-mode-map "kf" 'calc-prime-factors)
X    (define-key calc-mode-map "kg" 'calc-gcd)
X    (define-key calc-mode-map "kl" 'calc-lcm)
X    (define-key calc-mode-map "km" 'calc-moebius)
X    (define-key calc-mode-map "kn" 'calc-next-prime)
X    (define-key calc-mode-map "kp" 'calc-prime-test)
X    (define-key calc-mode-map "kr" 'calc-random)
X    (define-key calc-mode-map "kt" 'calc-totient)
X!   (define-key calc-mode-map "kG" 'calc-extended-gcd)
X  
X    (define-key calc-mode-map "m" nil)
X    (define-key calc-mode-map "m?" 'calc-m-prefix-help)
X--- 195,326 ----
X    (define-key calc-mode-map "d`" 'calc-realign)
X    (define-key calc-mode-map "d~" 'calc-refresh)
X  
X+   (define-key calc-mode-map "f" nil)
X+   (define-key calc-mode-map "f?" 'calc-f-prefix-help)
X+   (define-key calc-mode-map "fb" 'calc-beta)
X+   (define-key calc-mode-map "fe" 'calc-erf)
X+   (define-key calc-mode-map "fg" 'calc-gamma)
X+   (define-key calc-mode-map "fh" 'calc-hypot)
X+   (define-key calc-mode-map "fi" 'calc-im)
X+   (define-key calc-mode-map "fj" 'calc-bessel-J)
X+   (define-key calc-mode-map "fn" 'calc-min)
X+   (define-key calc-mode-map "fr" 'calc-re)
X+   (define-key calc-mode-map "fs" 'calc-sign)
X+   (define-key calc-mode-map "fx" 'calc-max)
X+   (define-key calc-mode-map "fy" 'calc-bessel-Y)
X+   (define-key calc-mode-map "fA" 'calc-abssqr)
X+   (define-key calc-mode-map "fB" 'calc-inc-beta)
X+   (define-key calc-mode-map "fE" 'calc-expm1)
X+   (define-key calc-mode-map "fF" 'calc-floor)
X+   (define-key calc-mode-map "fG" 'calc-inc-gamma)
X+   (define-key calc-mode-map "fI" 'calc-ilog)
X+   (define-key calc-mode-map "fL" 'calc-lnp1)
X+   (define-key calc-mode-map "fM" 'calc-mant-part)
X+   (define-key calc-mode-map "fQ" 'calc-isqrt)
X+   (define-key calc-mode-map "fS" 'calc-scale-float)
X+   (define-key calc-mode-map "fT" 'calc-arctan2)
X+   (define-key calc-mode-map "fX" 'calc-xpon-part)
X+   (define-key calc-mode-map "f[" 'calc-decrement)
X+   (define-key calc-mode-map "f]" 'calc-increment)
X+ 
X+   (define-key calc-mode-map "g" nil)
X+   (define-key calc-mode-map "g?" 'calc-g-prefix-help)
X+   (define-key calc-mode-map "ga" 'calc-graph-add)
X+   (define-key calc-mode-map "gc" 'calc-graph-clear)
X+   (define-key calc-mode-map "gd" 'calc-graph-delete)
X+   (define-key calc-mode-map "gf" 'calc-graph-fast)
X+   (define-key calc-mode-map "gg" 'calc-graph-grid)
X+   (define-key calc-mode-map "gh" 'calc-graph-header)
X+   (define-key calc-mode-map "gk" 'calc-graph-key)
X+   (define-key calc-mode-map "gj" 'calc-graph-juggle)
X+   (define-key calc-mode-map "gl" 'calc-graph-log-x)
X+   (define-key calc-mode-map "gn" 'calc-graph-name)
X+   (define-key calc-mode-map "gp" 'calc-graph-plot)
X+   (define-key calc-mode-map "gr" 'calc-graph-range-x)
X+   (define-key calc-mode-map "gs" 'calc-graph-line-style)
X+   (define-key calc-mode-map "gt" 'calc-graph-title-x)
X+   (define-key calc-mode-map "gv" 'calc-graph-view-commands)
X+   (define-key calc-mode-map "gx" 'calc-graph-display)
X+   (define-key calc-mode-map "gC" 'calc-graph-command)
X+   (define-key calc-mode-map "gD" 'calc-graph-device)
X+   (define-key calc-mode-map "gG" 'calc-argument)
X+   (define-key calc-mode-map "gH" 'calc-graph-hide)
X+   (define-key calc-mode-map "gK" 'calc-graph-kill)
X+   (define-key calc-mode-map "gL" 'calc-graph-log-y)
X+   (define-key calc-mode-map "gN" 'calc-graph-num-points)
X+   (define-key calc-mode-map "gO" 'calc-graph-output)
X+   (define-key calc-mode-map "gP" 'calc-graph-print)
X+   (define-key calc-mode-map "gR" 'calc-graph-range-y)
X+   (define-key calc-mode-map "gS" 'calc-graph-point-style)
X+   (define-key calc-mode-map "gT" 'calc-graph-title-y)
X+   (define-key calc-mode-map "gV" 'calc-graph-view-trail)
X+   (define-key calc-mode-map "gX" 'calc-graph-geometry)
X+   
X+   (define-key calc-mode-map "j" nil)
X+   (define-key calc-mode-map "j?" 'calc-j-prefix-help)
X+   (define-key calc-mode-map "ja" 'calc-select-additional)
X+   (define-key calc-mode-map "jb" 'calc-break-selections)
X+   (define-key calc-mode-map "jc" 'calc-clear-selections)
X+   (define-key calc-mode-map "jd" 'calc-show-selections)
X+   (define-key calc-mode-map "je" 'calc-enable-selections)
X+   (define-key calc-mode-map "jl" 'calc-select-less)
X+   (define-key calc-mode-map "jm" 'calc-select-more)
X+   (define-key calc-mode-map "jn" 'calc-select-next)
X+   (define-key calc-mode-map "jo" 'calc-select-once)
X+   (define-key calc-mode-map "jp" 'calc-select-previous)
X+   (define-key calc-mode-map "jr" 'calc-rewrite-selection)
X+   (define-key calc-mode-map "js" 'calc-select-here)
X+   (define-key calc-mode-map "jv" 'calc-sel-evaluate)
X+   (define-key calc-mode-map "ju" 'calc-unselect)
X+   (define-key calc-mode-map "jC" 'calc-sel-commute)
X+   (define-key calc-mode-map "jD" 'calc-sel-distribute)
X+   (define-key calc-mode-map "jE" 'calc-sel-jump-equals)
X+   (define-key calc-mode-map "jI" 'calc-sel-isolate)
X+   (define-key calc-mode-map "jJ" 'calc-conj)
X+   (define-key calc-mode-map "jL" 'calc-commute-left)
X+   (define-key calc-mode-map "jM" 'calc-sel-merge)
X+   (define-key calc-mode-map "jN" 'calc-sel-negate)
X+   (define-key calc-mode-map "jO" 'calc-select-once-maybe)
X+   (define-key calc-mode-map "jR" 'calc-commute-right)
X+   (define-key calc-mode-map "jS" 'calc-select-here-maybe)
X+   (define-key calc-mode-map "jU" 'calc-sel-unpack)
X+   (define-key calc-mode-map "j&" 'calc-sel-invert)
X+   (define-key calc-mode-map "j\r" 'calc-copy-selection)
X+   (define-key calc-mode-map "j\n" 'calc-copy-selection)
X+   (define-key calc-mode-map "j\008" 'calc-del-selection)
X+   (define-key calc-mode-map "j\177" 'calc-del-selection)
X+   (define-key calc-mode-map "j'" 'calc-enter-selection)
X+   (define-key calc-mode-map "j`" 'calc-edit-selection)
X+   (define-key calc-mode-map "j+" 'calc-sel-add-both-sides)
X+   (define-key calc-mode-map "j-" 'calc-sel-sub-both-sides)
X+   (define-key calc-mode-map "j*" 'calc-sel-mult-both-sides)
X+   (define-key calc-mode-map "j/" 'calc-sel-div-both-sides)
X+ 
X    (define-key calc-mode-map "k" nil)
X    (define-key calc-mode-map "k?" 'calc-k-prefix-help)
X    (define-key calc-mode-map "ka" 'calc-random-again)
X!   (define-key calc-mode-map "kb" 'calc-bernoulli-number)
X!   (define-key calc-mode-map "kc" 'calc-choose)
X    (define-key calc-mode-map "kd" 'calc-double-factorial)
X+   (define-key calc-mode-map "ke" 'calc-euler-number)
X    (define-key calc-mode-map "kf" 'calc-prime-factors)
X    (define-key calc-mode-map "kg" 'calc-gcd)
X+   (define-key calc-mode-map "kh" 'calc-shuffle)
X    (define-key calc-mode-map "kl" 'calc-lcm)
X    (define-key calc-mode-map "km" 'calc-moebius)
X    (define-key calc-mode-map "kn" 'calc-next-prime)
X    (define-key calc-mode-map "kp" 'calc-prime-test)
X    (define-key calc-mode-map "kr" 'calc-random)
X+   (define-key calc-mode-map "ks" 'calc-stirling-number)
X    (define-key calc-mode-map "kt" 'calc-totient)
X!   (define-key calc-mode-map "kB" 'calc-utpb)
X!   (define-key calc-mode-map "kC" 'calc-utpc)
X!   (define-key calc-mode-map "kE" 'calc-extended-gcd)
X!   (define-key calc-mode-map "kF" 'calc-utpf)
X!   (define-key calc-mode-map "kK" 'calc-call-last-kbd-macro)
X!   (define-key calc-mode-map "kN" 'calc-utpn)
X!   (define-key calc-mode-map "kP" 'calc-utpp)
X!   (define-key calc-mode-map "kT" 'calc-utpt)
X  
X    (define-key calc-mode-map "m" nil)
X    (define-key calc-mode-map "m?" 'calc-m-prefix-help)
X***************
X*** 219,226 ****
X--- 338,347 ----
X    (define-key calc-mode-map "mB" 'calc-bin-simplify-mode)
X    (define-key calc-mode-map "mD" 'calc-default-simplify-mode)
X    (define-key calc-mode-map "mE" 'calc-ext-simplify-mode)
X+   (define-key calc-mode-map "mM" 'calc-more-recursion-depth)
X    (define-key calc-mode-map "mN" 'calc-num-simplify-mode)
X    (define-key calc-mode-map "mO" 'calc-no-simplify-mode)
X+   (define-key calc-mode-map "mS" 'calc-shift-prefix)
X    (define-key calc-mode-map "mU" 'calc-units-simplify-mode)
X  
X    (define-key calc-mode-map "t" nil)
X***************
X*** 242,247 ****
X--- 363,369 ----
X    (define-key calc-mode-map "t]" 'calc-trail-last)
X    (define-key calc-mode-map "t<" 'calc-trail-scroll-left)
X    (define-key calc-mode-map "t>" 'calc-trail-scroll-right)
X+   (define-key calc-mode-map "t." 'calc-full-trail-vectors)
X  
X    (define-key calc-mode-map "u" 'nil)
X    (define-key calc-mode-map "u?" 'calc-u-prefix-help)
X***************
SHAR_EOF
echo "End of part 3, continue with part 4"
echo "4" > s2_seq_.tmp
exit 0



More information about the Comp.sources.misc mailing list