summaryrefslogtreecommitdiff
path: root/libguile/numbers.c
diff options
context:
space:
mode:
authorNeil Jerram <neil@ossau.uklinux.net>2008-09-17 21:46:40 +0100
committerNeil Jerram <neil@ossau.uklinux.net>2008-09-22 21:21:20 +0100
commit1dd797921c950f0a4d396faa6d7326ec6928e771 (patch)
tree74601a98f426ae788dfa69f46e47b5f3ff61a160 /libguile/numbers.c
parentf8c01b6f683e9a7e6962a70703cdad1f76771319 (diff)
downloadguile-1dd797921c950f0a4d396faa6d7326ec6928e771.tar.gz
Fix for incorrect (gcd -2) => -2; should give 2.
(reported by Bill Schottstaedt) * libguile/numbers.c (scm_gcd): When only one arg given, use scm_abs to ensure that result is non-negative. * test-suite/tests/numbers.test ("gcd"): New test, (gcd -2).
Diffstat (limited to 'libguile/numbers.c')
-rw-r--r--libguile/numbers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 7a4d619c8..52dfb73a8 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -1022,7 +1022,7 @@ SCM
scm_gcd (SCM x, SCM y)
{
if (SCM_UNBNDP (y))
- return SCM_UNBNDP (x) ? SCM_INUM0 : x;
+ return SCM_UNBNDP (x) ? SCM_INUM0 : scm_abs (x);
if (SCM_I_INUMP (x))
{