all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Peter Whaite <emacs@whaite.ca>
Cc: rms@gnu.org
Subject: Re: division of integers by floats
Date: Thu, 06 May 2004 17:17:47 -0400	[thread overview]
Message-ID: <200405062117.i46LHlKm015566@brains.moreideas.ca> (raw)
In-Reply-To: Your message of "Wed, 05 May 2004 16:21:14 EDT." <E1BLStG-00051v-UA@fencepost.gnu.org>

Richard Stallman <rms@gnu.org> 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)

  reply	other threads:[~2004-05-06 21:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-05 20:21 division of integers by floats Richard Stallman
2004-05-06 21:17 ` Peter Whaite [this message]
2004-05-08  1:21   ` Richard Stallman
2004-05-08 10:28     ` Piet van Oostrum
2004-05-09  0:49       ` Juanma Barranquero
2004-05-12 15:00       ` Peter Whaite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200405062117.i46LHlKm015566@brains.moreideas.ca \
    --to=emacs@whaite.ca \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.