]> code.delx.au - gnu-emacs/blobdiff - lisp/calc/calc-math.el
Update copyright year to 2014 by running admin/update-copyright.
[gnu-emacs] / lisp / calc / calc-math.el
index c17e801617e5cc4e8031cc7d64cdb495421d5aa4..1487d07dfce5f56b5290a51cafdd217223b4cee8 100644 (file)
@@ -1,7 +1,6 @@
 ;;; calc-math.el --- mathematical functions for Calc
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2014 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
@@ -105,7 +104,14 @@ If this can't be done, return NIL."
               (math-read-number
                (number-to-string
                 (funcall fn 
-                         (string-to-number (math-format-number (math-float x))))))
+                        (string-to-number 
+                         (let 
+                              ((calc-number-radix 10)
+                               (calc-twos-complement-mode nil)
+                               (calc-float-format (list 'float calc-internal-prec))
+                               (calc-group-digits nil)
+                               (calc-point-char "."))
+                           (math-format-number (math-float x)))))))
             (error nil))))))
 
 (defun calc-sqrt (arg)
@@ -771,18 +777,18 @@ If this can't be done, return NIL."
         (math-to-hms a 'rad))
        (t a)))
 
-(defun math-to-radians-2 (a)   ; [N N]
+(defun math-to-radians-2 (a &optional force-symbolic)   ; [N N]
   (cond ((eq (car-safe a) 'hms)
         (math-from-hms a 'rad))
        ((memq calc-angle-mode '(deg hms))
-        (if calc-symbolic-mode
+        (if (or calc-symbolic-mode force-symbolic)
             (math-div (math-mul a '(var pi var-pi)) 180)
           (math-mul a (math-pi-over-180))))
        (t a)))
 
-(defun math-from-radians-2 (a)   ; [N N]
+(defun math-from-radians-2 (a &optional force-symbolic)   ; [N N]
   (cond ((memq calc-angle-mode '(deg hms))
-        (if calc-symbolic-mode
+        (if (or calc-symbolic-mode force-symbolic)
             (math-div (math-mul 180 a) '(var pi var-pi))
           (math-div a (math-pi-over-180))))
        (t a)))
@@ -1568,7 +1574,7 @@ If this can't be done, return NIL."
         (if calc-infinite-mode
             '(neg (var inf var-inf))
           (math-reject-arg x "*Logarithm of zero")))
-       (calc-symbolic-mode (signal 'inexact-result nil))
+        (calc-symbolic-mode (signal 'inexact-result nil))
        ((Math-numberp x)
         (math-with-extra-prec 2
           (let ((xf (math-float x)))
@@ -2158,5 +2164,4 @@ If this can't be done, return NIL."
 
 (provide 'calc-math)
 
-;; arch-tag: c7367e8e-d0b8-4f70-8577-2fb3f31dbb4c
 ;;; calc-math.el ends here