bc: fix gcd on most negative fixnum

Xsmith found this fixnum-boundary bug.

Closes #3484
This commit is contained in:
Matthew Flatt 2020-11-05 17:24:54 -07:00
parent add9ed72c6
commit 6b7a184297
2 changed files with 5 additions and 1 deletions

View File

@ -1484,6 +1484,10 @@
(test 3.0 lcm 0.5 3)
(test 3.0 lcm 1/2 3.0)
(test 4611686018427387904 gcd -4611686018427387904)
(test 4611686018427387904 gcd -4611686018427387904 -4611686018427387904)
(test 4611686018427387904 gcd -4611686018427387904 0)
(err/rt-test (gcd +nan.0))
(err/rt-test (gcd +inf.0))
(err/rt-test (gcd -inf.0))

View File

@ -2350,7 +2350,7 @@ scheme_bin_gcd (const Scheme_Object *n1, const Scheme_Object *n2)
a = b;
b = r;
}
return (scheme_make_integer(a));
return (scheme_make_integer_value(a));
} else if (!scheme_is_integer(n1) || !scheme_is_integer(n2)) {
Scheme_Object *n1a, *n2a, *a[1], *num;