1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Use trunc in scm_i_inexact_truncate_divide

* libguile/numbers.c (scm_i_inexact_truncate_divide): Use trunc instead
  of floor and ceil.  Important for consistency with
  scm_truncate_quotient and scm_truncate_remainder.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Mark H Weaver 2011-02-15 06:10:06 -05:00 committed by Ludovic Courtès
parent 14d2ee3116
commit c15fe4999a

View file

@ -2450,11 +2450,8 @@ scm_i_inexact_truncate_divide (double x, double y, SCM *qp, SCM *rp)
scm_num_overflow (s_scm_truncate_divide); /* or return a NaN? */
else
{
double q, r, q1;
/* FIXME: Use trunc, after it has been imported from gnulib */
q1 = x / y;
q = (q1 >= 0) ? floor (q1) : ceil (q1);
r = x - q * y;
double q = trunc (x / y);
double r = x - q * y;
*qp = scm_from_double (q);
*rp = scm_from_double (r);
}