emacs-devel
[Top][All Lists]
Advanced

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

Re: division of integers by floats


From: Peter Whaite
Subject: Re: division of integers by floats
Date: Thu, 06 May 2004 17:17:47 -0400

Richard Stallman <address@hidden> 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 via email to

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