(calcVar-digit, calcVar-oper): Remove need for "var-" at the
[bpt/emacs.git] / lisp / calc / calc-frac.el
index dc5bf6e..cdb8ac9 100644 (file)
@@ -1,6 +1,9 @@
-;; Calculator for GNU Emacs, part II [calc-frac.el]
-;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
-;; Written by Dave Gillespie, daveg@synaptics.com.
+;;; calc-frac.el --- fraction functions for Calc
+
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
+
+;; Author: David Gillespie <daveg@synaptics.com>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
 ;; file named COPYING.  Among other things, the copyright notice
 ;; and this notice must be preserved on all copies.
 
+;;; Commentary:
 
+;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
-(require 'calc-ext)
 
+(require 'calc-ext)
 (require 'calc-macs)
 
-(defun calc-Need-calc-frac () nil)
-
-
 (defun calc-fdiv (arg)
   (interactive "P")
   (calc-slow-wrapper
-   (calc-binary-op ":" 'calcFunc-fdiv arg 1))
-)
+   (calc-binary-op ":" 'calcFunc-fdiv arg 1)))
 
 
 (defun calc-fraction (arg)
                                           (calc-top-n 1)))
        (calc-enter-result 1 "frac" (list func
                                         (calc-top-n 1)
-                                        (prefix-numeric-value (or arg 0)))))))
-)
+                                        (prefix-numeric-value (or arg 0))))))))
 
 
 (defun calc-over-notation (fmt)
-  (interactive "sFraction separator (:, ::, /, //, :/): ")
+  (interactive "sFraction separator: ")
   (calc-wrapper
    (if (string-match "\\`\\([^ 0-9][^ 0-9]?\\)[0-9]*\\'" fmt)
        (let ((n nil))
                   fmt (math-match-substring fmt 1)))
         (if (eq n 0) (error "Bad denominator"))
         (calc-change-mode 'calc-frac-format (list fmt n) t))
-     (error "Bad fraction separator format.")))
-)
+     (error "Bad fraction separator format"))))
 
 (defun calc-slash-notation (n)
   (interactive "P")
   (calc-wrapper
-   (calc-change-mode 'calc-frac-format (if n '("//" nil) '("/" nil)) t))
-)
+   (calc-change-mode 'calc-frac-format (if n '("//" nil) '("/" nil)) t)))
 
 
 (defun calc-frac-mode (n)
   (calc-wrapper
    (calc-change-mode 'calc-prefer-frac n nil t)
    (message (if calc-prefer-frac
-               "Integer division will now generate fractions."
-             "Integer division will now generate floating-point results.")))
-)
-
-
-
+               "Integer division will now generate fractions"
+             "Integer division will now generate floating-point results"))))
 
 
 ;;;; Fractions.
@@ -99,8 +93,7 @@
          (list 'frac num den))
       (if (equal gcd den)
          (math-quotient num gcd)
-       (list 'frac (math-quotient num gcd) (math-quotient den gcd)))))
-)
+       (list 'frac (math-quotient num gcd) (math-quotient den gcd))))))
 
 (defun calc-add-fractions (a b)
   (if (eq (car-safe a) 'frac)
                        (nth 2 a)))
     (math-make-frac (math-add (math-mul a (nth 2 b))
                              (nth 1 b))
-                   (nth 2 b)))
-)
+                   (nth 2 b))))
 
 (defun calc-mul-fractions (a b)
   (if (eq (car-safe a) 'frac)
        (math-make-frac (math-mul (nth 1 a) b)
                        (nth 2 a)))
     (math-make-frac (math-mul a (nth 1 b))
-                   (nth 2 b)))
-)
+                   (nth 2 b))))
 
 (defun calc-div-fractions (a b)
   (if (eq (car-safe a) 'frac)
        (math-make-frac (nth 1 a)
                        (math-mul (nth 2 a) b)))
     (math-make-frac (math-mul a (nth 2 b))
-                   (nth 1 b)))
-)
-
-
+                   (nth 1 b))))
 
 
 ;;; Convert a real value to fractional form.  [T R I; T R F] [Public]
        (t
         (let ((cfrac (math-continued-fraction a tol))
               (calc-prefer-frac t))
-          (math-eval-continued-fraction cfrac))))
-)
+          (math-eval-continued-fraction cfrac)))))
 
 (defun math-continued-fraction (a tol)
   (let ((calc-internal-prec (+ calc-internal-prec 2)))
              cfrac (cons int cfrac))
        (or (Math-zerop aa)
            (setq aa (math-div 1 aa))))
-      cfrac))
-)
+      cfrac)))
 
 (defun math-eval-continued-fraction (cf)
   (let ((n (car cf))
       (setq temp (math-add (math-mul (car cf) n) d)
            d n
            n temp))
-    (math-div n d))
-)
+    (math-div n d)))
 
 
 
              (math-reject-arg a "*Division by zero")
            (math-make-frac (math-trunc a) (math-trunc b)))
        (math-reject-arg b 'integerp))
-    (math-reject-arg a 'integerp))
-)
+    (math-reject-arg a 'integerp)))
+
+(provide 'calc-frac)
 
+;;; arch-tag: 89d65274-0b3b-42d8-aacd-eaf86da5b4ea
+;;; calc-frac.el ends here