1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-22 12:30:32 +02:00

(scm_integer_expt): Reject exponent +/-inf.

(scm_integer_p): +/-inf is not an integer.
Bug report by Bill Schottstaedt.
This commit is contained in:
Kevin Ryde 2004-09-07 00:12:45 +00:00
parent f1c82f55b9
commit 8bddb01ebb

View file

@ -1701,7 +1701,7 @@ SCM_DEFINE (scm_integer_expt, "integer-expt", 2, 0, 0,
else if (SCM_REALP (k)) else if (SCM_REALP (k))
{ {
double r = SCM_REAL_VALUE (k); double r = SCM_REAL_VALUE (k);
if (floor (r) != r) if (floor (r) != r || xisinf (r))
SCM_WRONG_TYPE_ARG (2, k); SCM_WRONG_TYPE_ARG (2, k);
if ((r > SCM_MOST_POSITIVE_FIXNUM) || (r < SCM_MOST_NEGATIVE_FIXNUM)) if ((r > SCM_MOST_POSITIVE_FIXNUM) || (r < SCM_MOST_NEGATIVE_FIXNUM))
{ {
@ -3095,6 +3095,8 @@ SCM_DEFINE (scm_integer_p, "integer?", 1, 0, 0,
if (SCM_COMPLEXP (x)) if (SCM_COMPLEXP (x))
return SCM_BOOL_F; return SCM_BOOL_F;
r = SCM_REAL_VALUE (x); r = SCM_REAL_VALUE (x);
if (xisinf (r))
return SCM_BOOL_F;
if (r == floor (r)) if (r == floor (r))
return SCM_BOOL_T; return SCM_BOOL_T;
return SCM_BOOL_F; return SCM_BOOL_F;