aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-08-04 04:17:08 +0000
committerRichard M. Stallman1993-08-04 04:17:08 +0000
commitaa29f9b923fce98355de5db3d41316d2992962eb (patch)
treed375c50d930286ea8c239a267df717e94ef815e9 /src
parent2adf4f6165a904bd5a3306ee129a258bd3050450 (diff)
downloademacs-aa29f9b923fce98355de5db3d41316d2992962eb.tar.gz
emacs-aa29f9b923fce98355de5db3d41316d2992962eb.zip
(Frem): Don't accept floats, just ints and markers.
Diffstat (limited to 'src')
-rw-r--r--src/data.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/src/data.c b/src/data.c
index 9c1413bdae2..a829e7d80ba 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1736,39 +1736,14 @@ The arguments must be numbers or markers.")
1736 1736
1737DEFUN ("%", Frem, Srem, 2, 2, 0, 1737DEFUN ("%", Frem, Srem, 2, 2, 0,
1738 "Returns remainder of first arg divided by second.\n\ 1738 "Returns remainder of first arg divided by second.\n\
1739Both must be numbers or markers.") 1739Both must be integers or markers.")
1740 (num1, num2) 1740 (num1, num2)
1741 register Lisp_Object num1, num2; 1741 register Lisp_Object num1, num2;
1742{ 1742{
1743 Lisp_Object val; 1743 Lisp_Object val;
1744 1744
1745#ifdef LISP_FLOAT_TYPE
1746 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0);
1747 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2, 0);
1748
1749 if (XTYPE (num1) == Lisp_Float || XTYPE (num2) == Lisp_Float)
1750 {
1751 double f1, f2;
1752
1753 f1 = XTYPE (num1) == Lisp_Float ? XFLOAT (num1)->data : XINT (num1);
1754 f2 = XTYPE (num2) == Lisp_Float ? XFLOAT (num2)->data : XINT (num2);
1755 if (f2 == 0)
1756 Fsignal (Qarith_error, Qnil);
1757
1758#if defined (USG) || defined (sun) || defined (ultrix) || defined (hpux)
1759 f1 = fmod (f1, f2);
1760#else
1761 f1 = drem (f1, f2);
1762#endif
1763 /* If the "remainder" comes out with the wrong sign, fix it. */
1764 if ((f1 < 0) != (f2 < 0))
1765 f1 += f2;
1766 return (make_float (f1));
1767 }
1768#else /* not LISP_FLOAT_TYPE */
1769 CHECK_NUMBER_COERCE_MARKER (num1, 0); 1745 CHECK_NUMBER_COERCE_MARKER (num1, 0);
1770 CHECK_NUMBER_COERCE_MARKER (num2, 1); 1746 CHECK_NUMBER_COERCE_MARKER (num2, 1);
1771#endif /* not LISP_FLOAT_TYPE */
1772 1747
1773 if (XFASTINT (num2) == 0) 1748 if (XFASTINT (num2) == 0)
1774 Fsignal (Qarith_error, Qnil); 1749 Fsignal (Qarith_error, Qnil);