summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-09-03 23:01:57 +0000
committerRichard M. Stallman <rms@gnu.org>1997-09-03 23:01:57 +0000
commitdf25ea6bb411e07a1b79c7c42649aaa3f3e4887f (patch)
treed85cf1c9296b9231a2c216487cfc7bc0a598f0c5
parent0c04d68a42a7ef688e19d6c533fd6379b8db837b (diff)
downloademacs-df25ea6bb411e07a1b79c7c42649aaa3f3e4887f.tar.gz
(emacs_rint): Define this,
either as a function or as a macro for rint. (Fround, Ffround): Use emacs_rint, not rint directly.
-rw-r--r--src/floatfns.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index 29bdccf2989..6c8aece417d 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */
Define HAVE_INVERSE_HYPERBOLIC if you have acosh, asinh, and atanh.
Define HAVE_CBRT if you have cbrt.
- Define HAVE_RINT if you have rint.
+ Define HAVE_RINT if you have a working rint.
If you don't define these, then the appropriate routines will be simulated.
Define HAVE_MATHERR if on a system supporting the SysV matherr callback.
@@ -826,9 +826,13 @@ round2 (i1, i2)
return q + (abs_r + (q & 1) <= abs_r1 ? 0 : (i2 ^ r) < 0 ? -1 : 1);
}
-#ifndef HAVE_RINT
+/* The code uses emacs_rint, so that it works to undefine HAVE_RINT
+ if `rint' exists but does not work right. */
+#ifdef HAVE_RINT
+#define emacs_rint rint
+#else
static double
-rint (d)
+emacs_rint (d)
double d;
{
return floor (d + 0.5);
@@ -866,7 +870,7 @@ With optional DIVISOR, return the nearest integer to ARG/DIVISOR.")
(arg, divisor)
Lisp_Object arg, divisor;
{
- return rounding_driver (arg, divisor, rint, round2, "round");
+ return rounding_driver (arg, divisor, emacs_rint, round2, "round");
}
DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0,
@@ -931,12 +935,12 @@ DEFUN ("fround", Ffround, Sfround, 1, 1, 0,
register Lisp_Object arg;
{
double d = extract_float (arg);
- IN_FLOAT (d = rint (d), "fround", arg);
+ IN_FLOAT (d = emacs_rint (d), "fround", arg);
return make_float (d);
}
DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0,
- "Truncate a floating point number to an integral float value.\n\
+ "Truncate a floating point number to an integral float value.\n\
Rounds the value toward zero.")
(arg)
register Lisp_Object arg;