diff options
author | Mark H Weaver <mhw@netris.org> | 2011-02-15 06:10:06 -0500 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2011-02-15 14:31:40 +0100 |
commit | c15fe4999aaeb63eb90c70d1af26e086c8c43362 (patch) | |
tree | d316a6ae38a79727ace9871d614cb11bd7e1a9eb | |
parent | 14d2ee311642338381e356ff0baa559e9a91bb8c (diff) | |
download | guile-c15fe4999aaeb63eb90c70d1af26e086c8c43362.tar.gz |
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>
-rw-r--r-- | libguile/numbers.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c index 59d8e7429..7c4ea1b50 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -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); } |