1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

* removed code enclosed within #ifdef BADIVSGNS ... #endif.

* scm_quotient: Fixed parameter number in error message.
* scm_remainder: Reordered dispatch sequence.
This commit is contained in:
Dirk Herrmann 2000-04-28 08:35:28 +00:00
parent e171f90f24
commit 89a7e495bc
2 changed files with 50 additions and 61 deletions

View file

@ -1,3 +1,14 @@
2000-04-28 Dirk Herrmann <D.Herrmann@tu-bs.de>
* numbers.c (scm_quotient, scm_remainder): Removed code that was
conditionally compiled based on BADIVSGNS. BADIVSGNS does not
occur anywhere else throughout guile.
* numbers.c (scm_quotient): Fixed parameter number in error
message.
* numbers.c (scm_remainder): Reordered dispatch sequence.
2000-04-25 Gary Houston <ghouston@arglist.com> 2000-04-25 Gary Houston <ghouston@arglist.com>
* posix.c (scm_execlp): docstring fix (thanks to Martin * posix.c (scm_execlp): docstring fix (thanks to Martin

View file

@ -176,19 +176,6 @@ scm_quotient (SCM x, SCM y)
scm_num_overflow (s_quotient); scm_num_overflow (s_quotient);
} else { } else {
long z = xx / yy; long z = xx / yy;
#ifdef BADIVSGNS
{
#if (__TURBOC__ == 1)
long t = ((yy < 0) ? -xx : xx) % yy;
#else
long t = xx % yy;
#endif
if ((t < 0) && (xx > 0))
z--;
else if ((t > 0) && (xx < 0))
z++;
}
#endif
if (SCM_FIXABLE (z)) { if (SCM_FIXABLE (z)) {
return SCM_MAKINUM (z); return SCM_MAKINUM (z);
} else { } else {
@ -245,7 +232,7 @@ scm_quotient (SCM x, SCM y)
} }
#endif #endif
} else { } else {
SCM_WTA_DISPATCH_2 (g_quotient, x, y, SCM_ARG2, s_quotient); SCM_WTA_DISPATCH_2 (g_quotient, x, y, SCM_ARG1, s_quotient);
} }
} }
@ -255,58 +242,49 @@ SCM_GPROC (s_remainder, "remainder", 2, 0, 0, scm_remainder, g_remainder);
SCM SCM
scm_remainder (SCM x, SCM y) scm_remainder (SCM x, SCM y)
{ {
register long z; if (SCM_INUMP (x)) {
#ifdef SCM_BIGDIG if (SCM_INUMP (y)) {
if (SCM_NINUMP (x)) long yy = SCM_INUM (y);
{ if (yy == 0) {
SCM_GASSERT2 (SCM_BIGP (x), scm_num_overflow (s_remainder);
g_remainder, x, y, SCM_ARG1, s_remainder); } else {
if (SCM_NINUMP (y))
{
SCM_ASRTGO (SCM_BIGP (y), bady);
return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
SCM_BDIGITS (y), SCM_NUMDIGS (y),
SCM_BIGSIGN (x), 0);
}
if (!(z = SCM_INUM (y)))
goto ov;
return scm_divbigint (x, z, SCM_BIGSIGN (x), 0);
}
if (SCM_NINUMP (y))
{
if (!SCM_BIGP (y))
{
bady:
SCM_WTA_DISPATCH_2 (g_remainder, x, y, SCM_ARG2, s_remainder);
}
return x;
}
#else
SCM_GASSERT2 (SCM_INUMP (x), g_remainder, x, y, SCM_ARG1, s_remainder);
SCM_GASSERT2 (SCM_INUMP (y), g_remainder, x, y, SCM_ARG2, s_remainder);
#endif
if (!(z = SCM_INUM (y)))
{
ov:
scm_num_overflow (s_remainder);
}
#if (__TURBOC__ == 1) #if (__TURBOC__ == 1)
if (z < 0) long z = SCM_INUM (x) % (yy < 0 ? -yy : yy);
z = -z; #else
long z = SCM_INUM (x) % yy;
#endif #endif
z = SCM_INUM (x) % z; return SCM_MAKINUM (z);
#ifdef BADIVSGNS }
if (!z); #ifdef SCM_BIGDIG
else if (z < 0) } else if (SCM_BIGP (y)) {
if (x < 0); return x;
else
z += SCM_INUM (y);
else if (x < 0)
z -= SCM_INUM (y);
#endif #endif
return SCM_MAKINUM (z); } else {
SCM_WTA_DISPATCH_2 (g_remainder, x, y, SCM_ARG2, s_remainder);
}
#ifdef SCM_BIGDIG
} else if (SCM_BIGP (x)) {
if (SCM_INUMP (y)) {
long yy = SCM_INUM (y);
if (yy == 0) {
scm_num_overflow (s_remainder);
} else {
return scm_divbigint (x, yy, SCM_BIGSIGN (x), 0);
}
} else if (SCM_BIGP (y)) {
return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
SCM_BDIGITS (y), SCM_NUMDIGS (y),
SCM_BIGSIGN (x), 0);
} else {
SCM_WTA_DISPATCH_2 (g_remainder, x, y, SCM_ARG2, s_remainder);
}
#endif
} else {
SCM_WTA_DISPATCH_2 (g_remainder, x, y, SCM_ARG1, s_remainder);
}
} }
SCM_GPROC (s_modulo, "modulo", 2, 0, 0, scm_modulo, g_modulo); SCM_GPROC (s_modulo, "modulo", 2, 0, 0, scm_modulo, g_modulo);
SCM SCM