mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 01:00:20 +02:00
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).
This commit is contained in:
parent
bed2e15fc9
commit
0bf4fe19a6
3 changed files with 7 additions and 1 deletions
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue