1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00:26 +02:00

* num2integral.i.c (NUM2INTEGRAL): Report an error when these

routines are passed an inexact.  This change in behavior is
motivated by concordance with R5RS: It is more common that a
primitive doesn't want to accept an inexact for an exact.
This commit is contained in:
Mikael Djurfeldt 2001-09-20 08:02:40 +00:00
parent 5a7f98d1ef
commit e45b0d385c
3 changed files with 24 additions and 10 deletions

View file

@ -70,15 +70,14 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
return res;
}
else if (SCM_REALP (num))
{ /* inexact */
double u = SCM_REAL_VALUE (num);
ITYPE res = u;
if ((double) res == u)
return res;
else
scm_out_of_range (s_caller, num);
}
/* Temporary special treatment of this case since behavior has changed */
scm_error (scm_arg_type_key,
s_caller,
(pos == 0) ? "Wrong type (inexact) argument: ~S"
: "Wrong type (inexact) argument in position ~A: ~S",
(pos == 0) ? scm_list_1 (num)
: scm_list_2 (SCM_MAKINUM (pos), num),
SCM_BOOL_F);
else
scm_wrong_type_arg (s_caller, pos, num);
}