emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113098: Add log2 support and make log10 obsolete fo


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113098: Add log2 support and make log10 obsolete for consistency.
Date: Thu, 20 Jun 2013 14:15:47 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113098
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2013-06-20 07:15:42 -0700
message:
  Add log2 support and make log10 obsolete for consistency.
  
  * configure.ac (log2): Check for this function.
  * doc/lispref/numbers.texi (Math Functions): Remove obsolete function log10.
  * lisp/subr.el (log10): Move here from C code, and declare as obsolete.
  All uses of (log10 X) replaced with (log X 10).
  * src/floatfns.c (Flog) [HAVE_LOG2]: Use log2 if available and if the
  base is 2; this is more accurate.
  (Flog10): Move to Lisp (marked obsolete there).
modified:
  ChangeLog                      changelog-20091113204419-o5vbwnq5f7feedwu-1538
  configure.ac                   
configure.in-20091113204419-o5vbwnq5f7feedwu-783
  doc/lispref/ChangeLog          changelog-20091113204419-o5vbwnq5f7feedwu-6155
  doc/lispref/numbers.texi       
numbers.texi-20091113204419-o5vbwnq5f7feedwu-6203
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/allout.el                 allout.el-20091113204419-o5vbwnq5f7feedwu-593
  lisp/calc/calc.el              calc.el-20091113204419-o5vbwnq5f7feedwu-2306
  lisp/subr.el                   subr.el-20091113204419-o5vbwnq5f7feedwu-151
  lisp/textmodes/rst.el          rst.el-20091113204419-o5vbwnq5f7feedwu-8690
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/floatfns.c                 floatfns.c-20091113204419-o5vbwnq5f7feedwu-141
=== modified file 'ChangeLog'
--- a/ChangeLog 2013-06-19 20:10:57 +0000
+++ b/ChangeLog 2013-06-20 14:15:42 +0000
@@ -1,3 +1,7 @@
+2013-06-20  RĂ¼diger Sonderfeld <address@hidden>
+
+       * configure.ac (log2): Check for this function.
+
 2013-06-19  Juanma Barranquero  <address@hidden>
 
        * .bzrignore: Add GNU GLOBAL files.

=== modified file 'configure.ac'
--- a/configure.ac      2013-06-17 06:03:19 +0000
+++ b/configure.ac      2013-06-20 14:15:42 +0000
@@ -3235,7 +3235,7 @@
 difftime posix_memalign \
 getpwent endpwent getgrent endgrent \
 touchlock \
-cfmakeraw cfsetspeed copysign __executable_start)
+cfmakeraw cfsetspeed copysign __executable_start log2)
 
 ## Eric Backus <address@hidden> says, HP-UX 9.x on HP 700 machines
 ## has a broken `rint' in some library versions including math library

=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2013-06-19 13:51:47 +0000
+++ b/doc/lispref/ChangeLog     2013-06-20 14:15:42 +0000
@@ -1,3 +1,7 @@
+2013-06-20  Paul Eggert  <address@hidden>
+
+       * numbers.texi (Math Functions): Remove obsolete function log10.
+
 2013-06-19  Stefan Monnier  <address@hidden>
 
        * modes.texi (Mode Line Data, Properties in Mode): Advertise `keymap'

=== modified file 'doc/lispref/numbers.texi'
--- a/doc/lispref/numbers.texi  2013-01-01 09:11:05 +0000
+++ b/doc/lispref/numbers.texi  2013-06-20 14:15:42 +0000
@@ -1156,11 +1156,6 @@
 returns a NaN.
 @end defun
 
address@hidden log10 arg
-This function returns the logarithm of @var{arg}, with base 10:
address@hidden(log10 @var{x})} @equiv{} @code{(log @var{x} 10)}.
address@hidden defun
-
 @defun expt x y
 This function returns @var{x} raised to power @var{y}.  If both
 arguments are integers and @var{y} is positive, the result is an

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-06-18 22:13:25 +0000
+++ b/etc/NEWS  2013-06-20 14:15:42 +0000
@@ -469,6 +469,7 @@
 ** New macro with-eval-after-load.  Like eval-after-load, but better behaved.
 
 ** Obsoleted functions:
+*** `log10'
 *** `dont-compile'
 *** `lisp-complete-symbol'
 *** `field-complete'

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-06-20 11:57:33 +0000
+++ b/lisp/ChangeLog    2013-06-20 14:15:42 +0000
@@ -1,3 +1,8 @@
+2013-06-20  Paul Eggert  <address@hidden>
+
+       * subr.el (log10): Move here from C code, and declare as obsolete.
+       All uses of (log10 X) replaced with (log X 10).
+
 2013-06-20  Juanma Barranquero  <address@hidden>
 
        * emacs-lisp/tabulated-list.el (tabulated-list-format): Fix typo.

=== modified file 'lisp/allout.el'
--- a/lisp/allout.el    2013-06-10 14:37:02 +0000
+++ b/lisp/allout.el    2013-06-20 14:15:42 +0000
@@ -5342,7 +5342,7 @@
                        (cons (make-string
                               (1+ (truncate (if (zerop (car flat-index))
                                                 1
-                                              (log10 (car flat-index)))))
+                                              (log (car flat-index) 10))))
                               ? )
                              result)))
            (setq flat-index (cdr flat-index)))
@@ -5382,7 +5382,7 @@
                        (cons (make-string
                               (1+ (truncate (if (zerop (car flat-index))
                                                 1
-                                              (log10 (car flat-index)))))
+                                              (log (car flat-index) 10))))
                               ? )
                              result)))
            (setq flat-index (cdr flat-index)))

=== modified file 'lisp/calc/calc.el'
--- a/lisp/calc/calc.el 2013-04-28 16:39:10 +0000
+++ b/lisp/calc/calc.el 2013-06-20 14:15:42 +0000
@@ -2485,7 +2485,7 @@
 
 
 (defconst math-bignum-digit-length
-  (truncate (/ (log10 (/ most-positive-fixnum 2)) 2))
+  (truncate (/ (log (/ most-positive-fixnum 2) 10) 2))
   "The length of a \"digit\" in Calc bignums.
 If a big integer is of the form (bigpos N0 N1 ...), this is the
 length of the allowable Emacs integers N0, N1,...

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2013-06-14 04:11:00 +0000
+++ b/lisp/subr.el      2013-06-20 14:15:42 +0000
@@ -1206,6 +1206,11 @@
   (declare (obsolete make-hash-table "22.1"))
   (make-hash-table :test (or test 'eql)))
 
+(defun log10 (x)
+  "Return (log X 10), the log base 10 of X."
+  (declare (obsolete log "24.4"))
+  (log x 10))
+
 ;; These are used by VM and some old programs
 (defalias 'focus-frame 'ignore "")
 (make-obsolete 'focus-frame "it does nothing." "22.1")

=== modified file 'lisp/textmodes/rst.el'
--- a/lisp/textmodes/rst.el     2013-05-15 23:55:41 +0000
+++ b/lisp/textmodes/rst.el     2013-06-20 14:15:42 +0000
@@ -2419,8 +2419,8 @@
                 ;; for the numbers.
                 (if (cdr node)
                     (setq fmt (format "%%-%dd"
-                                      (1+ (floor (log10 (length
-                                                        (cdr node))))))))))
+                                      (1+ (floor (log (length (cdr node))
+                                                     10))))))))
 
           (dolist (child (cdr node))
             (rst-toc-insert-node child

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-06-19 20:10:57 +0000
+++ b/src/ChangeLog     2013-06-20 14:15:42 +0000
@@ -1,3 +1,12 @@
+2013-06-20  Paul Eggert  <address@hidden>
+
+       * floatfns.c (Flog10): Move to Lisp (marked obsolete there).
+
+2013-06-20  RĂ¼diger Sonderfeld <address@hidden>
+
+       * floatfns.c (Flog) [HAVE_LOG2]: Use log2 if available and if the
+       base is 2; this is more accurate.
+
 2013-06-19  Juanma Barranquero  <address@hidden>
 
        * sound.c (string_default): Move to !WINDOWSNT section.

=== modified file 'src/floatfns.c'
--- a/src/floatfns.c    2013-06-20 01:19:43 +0000
+++ b/src/floatfns.c    2013-06-20 14:15:42 +0000
@@ -25,7 +25,8 @@
 /* C89 requires only the following math.h functions, and Emacs omits
    the starred functions since we haven't found a use for them:
    acos, asin, atan, atan2, ceil, cos, *cosh, exp, fabs, floor, fmod,
-   frexp, ldexp, log, log10, *modf, pow, sin, *sinh, sqrt, tan, *tanh.
+   frexp, ldexp, log, log10 [via (log X 10)], *modf, pow, sin, *sinh,
+   sqrt, tan, *tanh.
 
    C99 and C11 require the following math.h functions in addition to
    the C89 functions.  Of these, Emacs currently exports only the
@@ -33,10 +34,10 @@
    acosh, atanh, cbrt, *copysign, erf, erfc, exp2, expm1, fdim, fma,
    fmax, fmin, fpclassify, hypot, ilogb, isfinite, isgreater,
    isgreaterequal, isinf, isless, islessequal, islessgreater, *isnan,
-   isnormal, isunordered, lgamma, log1p, log2, *logb (approximately),
-   lrint/llrint, lround/llround, nan, nearbyint, nextafter,
-   nexttoward, remainder, remquo, *rint, round, scalbln, scalbn,
-   signbit, tgamma, trunc.
+   isnormal, isunordered, lgamma, log1p, *log2 [via (log X 2)], *logb
+   (approximately), lrint/llrint, lround/llround, nan, nearbyint,
+   nextafter, nexttoward, remainder, remquo, *rint, round, scalbln,
+   scalbn, signbit, tgamma, trunc.
  */
 
 #include <config.h>
@@ -252,21 +253,16 @@
 
       if (b == 10.0)
        d = log10 (d);
+#if HAVE_LOG2
+      else if (b == 2.0)
+       d = log2 (d);
+#endif
       else
        d = log (d) / log (b);
     }
   return make_float (d);
 }
 
-DEFUN ("log10", Flog10, Slog10, 1, 1, 0,
-       doc: /* Return the logarithm base 10 of ARG.  */)
-  (Lisp_Object arg)
-{
-  double d = extract_float (arg);
-  d = log10 (d);
-  return make_float (d);
-}
-
 DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0,
        doc: /* Return the square root of ARG.  */)
   (Lisp_Object arg)
@@ -564,7 +560,6 @@
   defsubr (&Sexp);
   defsubr (&Sexpt);
   defsubr (&Slog);
-  defsubr (&Slog10);
   defsubr (&Ssqrt);
 
   defsubr (&Sabs);


reply via email to

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