From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add support for log2. Date: Wed, 19 Jun 2013 19:36:14 -0700 Organization: UCLA Computer Science Department Message-ID: <51C26A9E.7080200@cs.ucla.edu> References: <1783344.43FasZRPlO@descartes> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1371695782 20044 80.91.229.3 (20 Jun 2013 02:36:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Jun 2013 02:36:22 +0000 (UTC) Cc: =?UTF-8?B?UsO8ZGlnZXIgU29uZGVyZmVsZA==?= , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 20 04:36:23 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UpUjV-0008Kp-6b for ged-emacs-devel@m.gmane.org; Thu, 20 Jun 2013 04:36:21 +0200 Original-Received: from localhost ([::1]:57960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpUjU-0005gz-RL for ged-emacs-devel@m.gmane.org; Wed, 19 Jun 2013 22:36:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpUjS-0005gu-4L for emacs-devel@gnu.org; Wed, 19 Jun 2013 22:36:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpUjQ-0005tc-RH for emacs-devel@gnu.org; Wed, 19 Jun 2013 22:36:18 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:35223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpUjQ-0005tX-Ij for emacs-devel@gnu.org; Wed, 19 Jun 2013 22:36:16 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id B2FB139E8109; Wed, 19 Jun 2013 19:36:15 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g-I3Ic8pgEn3; Wed, 19 Jun 2013 19:36:14 -0700 (PDT) Original-Received: from [192.168.1.9] (pool-71-108-49-126.lsanca.fios.verizon.net [71.108.49.126]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 7421839E8105; Wed, 19 Jun 2013 19:36:14 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 In-Reply-To: X-Enigmail-Version: 1.5.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:160724 Archived-At: Elisp already has a syntax for log2 (X), namely (log X 2), so how about the following more-conservative change? This avoids adding the "log2" function to the Emacs namespace, thus no need for a NEWS entry, doc change, etc. (I know the same argument applies to log10, but that horse left the barn long ago.) =3D=3D=3D modified file 'ChangeLog' --- ChangeLog 2013-06-19 20:10:57 +0000 +++ ChangeLog 2013-06-20 02:32:16 +0000 @@ -1,3 +1,7 @@ +2013-06-20 R=C3=BCdiger Sonderfeld + + * configure.ac (log2): Check for this function. + 2013-06-19 Juanma Barranquero =20 * .bzrignore: Add GNU GLOBAL files. =3D=3D=3D modified file 'configure.ac' --- configure.ac 2013-06-17 06:03:19 +0000 +++ configure.ac 2013-06-20 02:31:58 +0000 @@ -3235,7 +3235,7 @@ difftime posix_memalign \ getpwent endpwent getgrent endgrent \ touchlock \ -cfmakeraw cfsetspeed copysign __executable_start) +cfmakeraw cfsetspeed copysign __executable_start log2) =20 ## Eric Backus says, HP-UX 9.x on HP 700 machines ## has a broken `rint' in some library versions including math library =3D=3D=3D modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-19 20:10:57 +0000 +++ src/ChangeLog 2013-06-20 02:31:58 +0000 @@ -1,3 +1,8 @@ +2013-06-20 R=C3=BCdiger Sonderfeld + + * floatfns.c (Flog) [HAVE_LOG2]: Use log2 if available and if the + base is 2; in practice it's more accurate. + 2013-06-19 Juanma Barranquero =20 * sound.c (string_default): Move to !WINDOWSNT section. =3D=3D=3D modified file 'src/floatfns.c' --- src/floatfns.c 2013-06-20 01:19:43 +0000 +++ src/floatfns.c 2013-06-20 02:31:58 +0000 @@ -33,10 +33,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. */ =20 #include @@ -252,6 +252,10 @@ =20 if (b =3D=3D 10.0) d =3D log10 (d); +#if HAVE_LOG2 + else if (b =3D=3D 2.0) + d =3D log2 (d); +#endif else d =3D log (d) / log (b); }