From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Peter Whaite Newsgroups: gmane.emacs.devel Subject: Re: division of integers by floats Date: Thu, 06 May 2004 17:17:47 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200405062117.i46LHlKm015566@brains.moreideas.ca> References: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1083878743 10922 80.91.224.253 (6 May 2004 21:25:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 May 2004 21:25:43 +0000 (UTC) Cc: rms@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu May 06 23:25:35 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BLqN5-0003uK-00 for ; Thu, 06 May 2004 23:25:35 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BLqN5-0001fJ-00 for ; Thu, 06 May 2004 23:25:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BLqII-0002Qk-Um for emacs-devel@quimby.gnus.org; Thu, 06 May 2004 17:20:38 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BLqGv-0002DZ-Th for emacs-devel@gnu.org; Thu, 06 May 2004 17:19:13 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BLqGG-0001yZ-OH for emacs-devel@gnu.org; Thu, 06 May 2004 17:19:09 -0400 Original-Received: from [199.185.220.220] (helo=priv-edtnes57.telusplanet.net) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BLqGG-0001y9-8e; Thu, 06 May 2004 17:18:32 -0400 Original-Received: from brains.moreideas.ca ([142.169.171.181]) by priv-edtnes04.telusplanet.net (InterMail vM.6.00.05.02 201-2115-109-103-20031105) with ESMTP id <20040506211759.IXXB15258.priv-edtnes04.telusplanet.net@brains.moreideas.ca>; Thu, 6 May 2004 15:17:59 -0600 Original-Received: from brains.moreideas.ca (localhost.localdomain [127.0.0.1]) by brains.moreideas.ca (8.12.8/8.12.8) with ESMTP id i46LHldv015571; Thu, 6 May 2004 17:17:47 -0400 Original-Received: from brains.moreideas.ca (peta@localhost) by brains.moreideas.ca (8.12.8/8.12.8/Submit) with ESMTP id i46LHlKm015566; Thu, 6 May 2004 17:17:47 -0400 Original-To: emacs-devel@gnu.org In-Reply-To: Your message of "Wed, 05 May 2004 16:21:14 EDT." X-Mailer: MH-E 7.4.3+cvs; nmh 1.0.4; GNU Emacs 21.3.50.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22881 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22881 Richard Stallman wrote: > It seems like this is the best change to make. Does it give correct > results? It does with limited testing, but having it in the arith_driver like that means the argument list gets unnecessarily scanned for floats when there are 2 arguments. Here's a patch to put the change in the DEFUN. Note that there is no effective change for the two arg form, so its still efficient and there wont be any "surprises" for the dominant usage. --- data.c 6 May 2004 00:10:15 -0000 1.237 +++ data.c 6 May 2004 20:24:25 -0000 @@ -2698,7 +2698,13 @@ int nargs; Lisp_Object *args; { - return arith_driver (Adiv, nargs, args); + int argnum; + if (nargs == 2) + return arith_driver (Adiv, nargs, args); + for (argnum = 0; argnum < nargs; argnum++) + if (FLOATP (args[argnum])) + return float_arith_driver (0, 0, Adiv, nargs, args); + return arith_driver (Adiv, nargs, args); } DEFUN ("%", Frem, Srem, 2, 2, 0, -- Peter Whaite (http://whaite.ca)