/[emacs]/emacs/lisp/calc/calc-math.el
ViewVC logotype

Diff of /emacs/lisp/calc/calc-math.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by walters, Wed Nov 14 09:05:36 2001 UTC revision 1.3 by walters, Mon Nov 19 07:36:24 2001 UTC
# Line 1  Line 1 
1  ;; Calculator for GNU Emacs, part II [calc-math.el]  ;;; calc-math.el --- mathematical functions for Calc
2    
3  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
4  ;; Written by Dave Gillespie, daveg@synaptics.com.  
5    ;; Author: David Gillespie <daveg@synaptics.com>
6    ;; Maintainer: Colin Walters <walters@debian.org>
7    
8  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
9    
# Line 19  Line 22 
22  ;; file named COPYING.  Among other things, the copyright notice  ;; file named COPYING.  Among other things, the copyright notice
23  ;; and this notice must be preserved on all copies.  ;; and this notice must be preserved on all copies.
24    
25    ;;; Commentary:
26    
27    ;;; Code:
28    
29  ;; This file is autoloaded from calc-ext.el.  ;; This file is autoloaded from calc-ext.el.
30  (require 'calc-ext)  (require 'calc-ext)
# Line 236  Line 241 
241    (cond ((= arg 1)    (cond ((= arg 1)
242           (calc-wrapper           (calc-wrapper
243            (calc-change-mode 'calc-angle-mode 'deg)            (calc-change-mode 'calc-angle-mode 'deg)
244            (message "Angles measured in degrees.")))            (message "Angles measured in degrees")))
245          ((= arg 2) (calc-radians-mode))          ((= arg 2) (calc-radians-mode))
246          ((= arg 3) (calc-hms-mode))          ((= arg 3) (calc-hms-mode))
247          (t (error "Prefix argument out of range"))))          (t (error "Prefix argument out of range"))))
# Line 245  Line 250 
250    (interactive)    (interactive)
251    (calc-wrapper    (calc-wrapper
252     (calc-change-mode 'calc-angle-mode 'rad)     (calc-change-mode 'calc-angle-mode 'rad)
253     (message "Angles measured in radians.")))     (message "Angles measured in radians")))
254    
255    
256  ;;; Compute the integer square-root floor(sqrt(A)).  A > 0.  [I I] [Public]  ;;; Compute the integer square-root floor(sqrt(A)).  A > 0.  [I I] [Public]
# Line 412  Line 417 
417     (progn     (progn
418       (calc-record-why 'numberp a)       (calc-record-why 'numberp a)
419       (list 'calcFunc-sqrt a))))       (list 'calcFunc-sqrt a))))
420  (defalias calcFunc-sqrt 'math-sqrt)  (defalias 'calcFunc-sqrt 'math-sqrt)
421    
422  (defun math-infinite-dir (a &optional inf)  (defun math-infinite-dir (a &optional inf)
423    (or inf (setq inf (math-infinitep a)))    (or inf (setq inf (math-infinitep a)))
# Line 532  Line 537 
537          ((eq (car-safe b) 'hms)          ((eq (car-safe b) 'hms)
538           (math-to-hms (math-hypot a (math-from-hms b 'deg))))           (math-to-hms (math-hypot a (math-from-hms b 'deg))))
539          (t nil)))          (t nil)))
540  (defalias calcFunc-hypot 'math-hypot)  (defalias 'calcFunc-hypot 'math-hypot)
541    
542  (defun calcFunc-sqr (x)  (defun calcFunc-sqr (x)
543    (math-pow x 2))    (math-pow x 2))
# Line 1324  Line 1329 
1329      (cons (equal pow x) sum)))      (cons (equal pow x) sum)))
1330    
1331    
1332    (defvar math-log-base-cache nil)
1333  (defun math-log-base-raw (b)   ; [N N]  (defun math-log-base-raw (b)   ; [N N]
1334    (if (not (and (equal (car math-log-base-cache) b)    (if (not (and (equal (car math-log-base-cache) b)
1335                  (eq (nth 1 math-log-base-cache) calc-internal-prec)))                  (eq (nth 1 math-log-base-cache) calc-internal-prec)))
1336        (setq math-log-base-cache (list b calc-internal-prec        (setq math-log-base-cache (list b calc-internal-prec
1337                                        (math-ln-raw (math-float b)))))                                        (math-ln-raw (math-float b)))))
1338    (nth 2 math-log-base-cache))    (nth 2 math-log-base-cache))
 (setq math-log-base-cache nil)  
1339    
1340  (defun calcFunc-lnp1 (x)   ; [N N] [Public]  (defun calcFunc-lnp1 (x)   ; [N N] [Public]
1341    (cond ((Math-equal-int x -1)    (cond ((Math-equal-int x -1)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26