emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calc/calc-math.el [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc-math.el [emacs-unicode-2]
Date: Wed, 08 Dec 2004 01:05:04 -0500

Index: emacs/lisp/calc/calc-math.el
diff -c emacs/lisp/calc/calc-math.el:1.7.4.1 
emacs/lisp/calc/calc-math.el:1.7.4.2
*** emacs/lisp/calc/calc-math.el:1.7.4.1        Fri Apr 16 12:50:11 2004
--- emacs/lisp/calc/calc-math.el        Wed Dec  8 05:02:17 2004
***************
*** 3,10 ****
  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
  
  ;; Author: David Gillespie <address@hidden>
! ;; Maintainers: D. Goel <address@hidden>
! ;;              Colin Walters <address@hidden>
  
  ;; This file is part of GNU Emacs.
  
--- 3,9 ----
  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
  
  ;; Author: David Gillespie <address@hidden>
! ;; Maintainer: Jay Belanger <address@hidden>
  
  ;; This file is part of GNU Emacs.
  
***************
*** 28,40 ****
  ;;; Code:
  
  ;; This file is autoloaded from calc-ext.el.
- (require 'calc-ext)
  
  (require 'calc-macs)
  
- (defun calc-Need-calc-math () nil)
- 
- 
  (defun calc-sqrt (arg)
    (interactive "P")
    (calc-slow-wrapper
--- 27,36 ----
  ;;; Code:
  
  ;; This file is autoloaded from calc-ext.el.
  
+ (require 'calc-ext)
  (require 'calc-macs)
  
  (defun calc-sqrt (arg)
    (interactive "P")
    (calc-slow-wrapper
***************
*** 574,612 ****
           (and root (list 'polar root (math-div (nth 2 a) n)))))
        (t nil)))
  
! (defun math-nth-root-float (a n &optional guess)
    (math-inexact-result)
    (math-with-extra-prec 1
!     (let ((nf (math-float n))
!         (nfm1 (math-float (1- n))))
        (math-nth-root-float-iter a (or guess
                                      (math-make-float
                                       1 (/ (+ (math-numdigs (nth 1 a))
                                               (nth 2 a)
!                                              (/ n 2))
!                                           n)))))))
  
! (defun math-nth-root-float-iter (a guess)   ; uses "n", "nf", "nfm1"
    (math-working "root" guess)
!   (let ((g2 (math-div-float (math-add-float (math-mul nfm1 guess)
                                            (math-div-float
!                                            a (math-ipow guess (1- n))))
!                           nf)))
      (if (math-nearly-equal-float g2 guess)
        g2
        (math-nth-root-float-iter a g2))))
  
! (defun math-nth-root-integer (a n &optional guess)   ; [I I S]
    (math-nth-root-int-iter a (or guess
                                (math-scale-int 1 (/ (+ (math-numdigs a)
!                                                       (1- n))
!                                                    n)))))
  
! (defun math-nth-root-int-iter (a guess)   ; uses "n"
    (math-working "root" guess)
!   (let* ((q (math-idivmod a (math-ipow guess (1- n))))
!        (s (math-add (car q) (math-mul (1- n) guess)))
!        (g2 (math-idivmod s n)))
      (if (Math-natnum-lessp (car g2) guess)
        (math-nth-root-int-iter a (car g2))
        (cons (and (equal (car g2) guess)
--- 570,620 ----
           (and root (list 'polar root (math-div (nth 2 a) n)))))
        (t nil)))
  
! ;; The variables math-nrf-n, math-nrf-nf and math-nrf-nfm1 are local
! ;; to math-nth-root-float, but are used by math-nth-root-float-iter,
! ;; which is called by math-nth-root-float.
! (defvar math-nrf-n)
! (defvar math-nrf-nf)
! (defvar math-nrf-nfm1)
! 
! (defun math-nth-root-float (a math-nrf-n &optional guess)
    (math-inexact-result)
    (math-with-extra-prec 1
!     (let ((math-nrf-nf (math-float math-nrf-n))
!         (math-nrf-nfm1 (math-float (1- math-nrf-n))))
        (math-nth-root-float-iter a (or guess
                                      (math-make-float
                                       1 (/ (+ (math-numdigs (nth 1 a))
                                               (nth 2 a)
!                                              (/ math-nrf-n 2))
!                                           math-nrf-n)))))))
  
! (defun math-nth-root-float-iter (a guess)
    (math-working "root" guess)
!   (let ((g2 (math-div-float (math-add-float (math-mul math-nrf-nfm1 guess)
                                            (math-div-float
!                                            a (math-ipow guess (1- 
math-nrf-n))))
!                           math-nrf-nf)))
      (if (math-nearly-equal-float g2 guess)
        g2
        (math-nth-root-float-iter a g2))))
  
! ;; The variable math-nri-n is local to math-nth-root-integer, but
! ;; is used by math-nth-root-int-iter, which is called by
! ;; math-nth-root-int.
! (defvar math-nri-n)
! 
! (defun math-nth-root-integer (a math-nri-n &optional guess)   ; [I I S]
    (math-nth-root-int-iter a (or guess
                                (math-scale-int 1 (/ (+ (math-numdigs a)
!                                                       (1- math-nri-n))
!                                                    math-nri-n)))))
  
! (defun math-nth-root-int-iter (a guess)
    (math-working "root" guess)
!   (let* ((q (math-idivmod a (math-ipow guess (1- math-nri-n))))
!        (s (math-add (car q) (math-mul (1- math-nri-n) guess)))
!        (g2 (math-idivmod s math-nri-n)))
      (if (Math-natnum-lessp (car g2) guess)
        (math-nth-root-int-iter a (car g2))
        (cons (and (equal (car g2) guess)
***************
*** 1247,1253 ****
             (math-div (calcFunc-ln x) 0)
           (math-reject-arg b "*Logarithm base one")))
        ((math-equal-int x 1)
!        (if (or (math-floatp a) (math-floatp b)) '(float 0 0) 0))
        ((and (Math-ratp x) (Math-ratp b)
              (math-posp x) (math-posp b)
              (let* ((sign 1) (inv nil)
--- 1255,1261 ----
             (math-div (calcFunc-ln x) 0)
           (math-reject-arg b "*Logarithm base one")))
        ((math-equal-int x 1)
!        (if (math-floatp b) '(float 0 0) 0))
        ((and (Math-ratp x) (Math-ratp b)
              (math-posp x) (math-posp b)
              (let* ((sign 1) (inv nil)
***************
*** 1676,1680 ****
--- 1684,1690 ----
        (t (list 'calcFunc-deg a))))
  (put 'calcFunc-deg 'math-expandable t)
  
+ (provide 'calc-math)
+ 
  ;;; arch-tag: c7367e8e-d0b8-4f70-8577-2fb3f31dbb4c
  ;;; calc-math.el ends here




reply via email to

[Prev in Thread] Current Thread [Next in Thread]