guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-15-112-gc


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-15-112-gc251ab6
Date: Tue, 15 Feb 2011 08:16:00 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=c251ab631e7daa0eff87b774358cb5796fe263c4

The branch, master has been updated
       via  c251ab631e7daa0eff87b774358cb5796fe263c4 (commit)
       via  a6b087be1b46aaa8410e1460db5a2c0801650ce9 (commit)
      from  79b3863d8c36275766c288992507252917255c62 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c251ab631e7daa0eff87b774358cb5796fe263c4
Author: Mark H Weaver <address@hidden>
Date:   Mon Feb 14 17:10:03 2011 -0500

    Use trunc instead of scm_c_truncate
    
    * libguile/numbers.c (scm_c_truncate, scm_truncate_number,
      scm_i_inexact_truncate_quotient, scm_i_inexact_truncate_remainder):
      Use trunc directly, now that we have its gnulib module.

commit a6b087be1b46aaa8410e1460db5a2c0801650ce9
Author: Mark H Weaver <address@hidden>
Date:   Sun Feb 13 16:28:34 2011 -0500

    Fix minor errors in docs of division operators
    
    * doc/ref/api-data.texi (Arithmetic): The R5RS `quotient', `remainder',
      and `modulo' operators are exact-integer-only operators.  `modulo' is
      equivalent to `floor-remainder', not `floor-quotient'.

-----------------------------------------------------------------------

Summary of changes:
 doc/ref/api-data.texi |    7 ++++---
 libguile/numbers.c    |   13 +++----------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index a8cce24..5bef926 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -1308,7 +1308,7 @@ both @var{q} and @var{r}, and is more efficient than 
computing each
 separately.  Note that @var{r}, if non-zero, will have the same sign
 as @var{y}.
 
-When @var{x} and @var{y} are integers, @code{floor-quotient} is
+When @var{x} and @var{y} are exact integers, @code{floor-remainder} is
 equivalent to the R5RS integer-only operator @code{modulo}.
 
 @lisp
@@ -1365,8 +1365,9 @@ both @var{q} and @var{r}, and is more efficient than 
computing each
 separately.  Note that @var{r}, if non-zero, will have the same sign
 as @var{x}.
 
-When @var{x} and @var{y} are integers, these operators are equivalent to
-the R5RS integer-only operators @code{quotient} and @code{remainder}.
+When @var{x} and @var{y} are exact integers, these operators are
+equivalent to the R5RS integer-only operators @code{quotient} and
address@hidden
 
 @lisp
 (truncate-quotient 123 10) @result{} 12
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 81d689d..59d8e74 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -2139,7 +2139,7 @@ scm_i_inexact_truncate_quotient (double x, double y)
   if (SCM_UNLIKELY (y == 0))
     scm_num_overflow (s_scm_truncate_quotient);  /* or return a NaN? */
   else
-    return scm_from_double (scm_c_truncate (x / y));
+    return scm_from_double (trunc (x / y));
 }
 
 static SCM
@@ -2274,7 +2274,7 @@ scm_i_inexact_truncate_remainder (double x, double y)
   if (SCM_UNLIKELY (y == 0))
     scm_num_overflow (s_scm_truncate_remainder);  /* or return a NaN? */
   else
-    return scm_from_double (x - y * scm_c_truncate (x / y));
+    return scm_from_double (x - y * trunc (x / y));
 }
 
 static SCM
@@ -8173,14 +8173,7 @@ static SCM scm_divide2real (SCM x, SCM y)
 double
 scm_c_truncate (double x)
 {
-#if HAVE_TRUNC
   return trunc (x);
-#else
-  if (x < 0.0)
-    return ceil (x);
-  else
-    return floor (x);
-#endif
 }
 
 /* scm_c_round is done using floor(x+0.5) to round to nearest and with
@@ -8233,7 +8226,7 @@ SCM_PRIMITIVE_GENERIC (scm_truncate_number, "truncate", 
1, 0, 0,
   if (SCM_I_INUMP (x) || SCM_BIGP (x))
     return x;
   else if (SCM_REALP (x))
-    return scm_from_double (scm_c_truncate (SCM_REAL_VALUE (x)));
+    return scm_from_double (trunc (SCM_REAL_VALUE (x)));
   else if (SCM_FRACTIONP (x))
     return scm_truncate_quotient (SCM_FRACTION_NUMERATOR (x),
                                  SCM_FRACTION_DENOMINATOR (x));


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]