[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, master, updated. release_1-9-11-41-g5a
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-11-41-g5a8fc75 |
Date: |
Thu, 10 Jun 2010 16:11:36 +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=5a8fc758b094b7bdba83d63d385016960434ce9d
The branch, master has been updated
via 5a8fc758b094b7bdba83d63d385016960434ce9d (commit)
from 02fcbf78b27788c03563e5c3d297a4cd469ce562 (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 5a8fc758b094b7bdba83d63d385016960434ce9d
Author: Andy Wingo <address@hidden>
Date: Thu Jun 10 18:14:02 2010 +0200
expt / integer-expt fixes
* libguile/numbers.c (scm_integer_expt): Validate the first arg as a
number.
(scm_expt): Delegate to scm_integer_expt iff x is exact. Fixes
fractions.test, which I broke recently
* test-suite/tests/numbers.test ("integer-expt"): Add test for
(integer-expt #t 0).
-----------------------------------------------------------------------
Summary of changes:
libguile/numbers.c | 4 +++-
test-suite/tests/numbers.test | 2 ++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/libguile/numbers.c b/libguile/numbers.c
index ca4330b..509e1c1 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -1802,6 +1802,8 @@ SCM_DEFINE (scm_integer_expt, "integer-expt", 2, 0, 0,
int i2_is_big = 0;
SCM acc = SCM_I_MAKINUM (1L);
+ SCM_VALIDATE_NUMBER (SCM_ARG1, n);
+
/* 0^0 == 1 according to R5RS */
if (scm_is_eq (n, SCM_INUM0) || scm_is_eq (n, acc))
return scm_is_false (scm_zero_p(k)) ? n : acc;
@@ -5466,7 +5468,7 @@ SCM_DEFINE (scm_expt, "expt", 2, 0, 0,
"Return @var{x} raised to the power of @var{y}.")
#define FUNC_NAME s_scm_expt
{
- if ((SCM_I_INUMP (x) || SCM_BIGP (x)) && scm_is_integer (y))
+ if (scm_is_true (scm_exact_p (x)) && scm_is_integer (y))
return scm_integer_expt (x, y);
else if (scm_is_real (x) && scm_is_real (y) && scm_to_double (x) >= 0.0)
{
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index fae86e4..1d7cb7c 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -2995,6 +2995,8 @@
(with-test-prefix "integer-expt"
+ (pass-if-exception "non-numeric base" exception:wrong-type-arg
+ (integer-expt #t 0))
(pass-if-exception "2^+inf" exception:wrong-type-arg
(integer-expt 2 +inf.0))
(pass-if-exception "2^-inf" exception:wrong-type-arg
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-11-41-g5a8fc75,
Andy Wingo <=