# HG changeset patch # User Karl Heuer # Date 760393139 0 # Node ID 6130ebde8d3bce9360836d66b8955a4efbcc3645 # Parent 07a36e38e514c2665d1f1224423de1ee318d93f9 (fmod): Implement it on systems where it's missing, using drem if available. diff -r 07a36e38e514 -r 6130ebde8d3b src/data.c --- a/src/data.c Fri Feb 04 17:13:26 1994 +0000 +++ b/src/data.c Fri Feb 04 20:18:59 1994 +0000 @@ -1778,6 +1778,19 @@ return val; } +#ifndef HAVE_FMOD +double +fmod (f1, f2) + double f1, f2; +{ +#ifdef HAVE_DREM /* Some systems use this non-standard name. */ + return (drem (f1, f2)); +#else /* Other systems don't seem to have it at all. */ + return (f1 - f2 * floor (f1/f2)); +#endif +} +#endif /* ! HAVE_FMOD */ + DEFUN ("mod", Fmod, Smod, 2, 2, 0, "Returns X modulo Y.\n\ The result falls between zero (inclusive) and Y (exclusive).\n\ @@ -1801,11 +1814,7 @@ if (f2 == 0) Fsignal (Qarith_error, Qnil); -#ifdef HAVE_FMOD f1 = fmod (f1, f2); -#else - f1 = drem (f1, f2); -#endif /* If the "remainder" comes out with the wrong sign, fix it. */ if ((f1 < 0) != (f2 < 0)) f1 += f2;