1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-21 12:10: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:17:25 +00:00
parent 9d7e6c84ca
commit 147c18a0e4
3 changed files with 20 additions and 11 deletions

10
NEWS
View file

@ -1186,13 +1186,21 @@ intended to be used in user code. You should avoid dealing with
bignums directly, and should deal with numbers in general (which can bignums directly, and should deal with numbers in general (which can
be bignums). be bignums).
** Change in behavior: scm_num2long, scm_num2ulong
The scm_num2[u]long functions don't any longer accept an inexact
argument. 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.
** New functions: scm_short2num, scm_ushort2num, scm_int2num, ** New functions: scm_short2num, scm_ushort2num, scm_int2num,
scm_uint2num, scm_size2num, scm_ptrdiff2num, scm_num2short, scm_uint2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2ptrdiff, scm_num2ushort, scm_num2int, scm_num2uint, scm_num2ptrdiff,
scm_num2size. scm_num2size.
These are conversion functions between the various ANSI C integral These are conversion functions between the various ANSI C integral
types and Scheme numbers. types and Scheme numbers. NOTE: The scm_num2xxx functions don't
accept an inexact argument.
** New number validation macros: ** New number validation macros:
SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,INT,UINT}[_DEF] SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,INT,UINT}[_DEF]

View file

@ -1,3 +1,14 @@
2001-09-20 Mikael Djurfeldt <mdj@linnaeus>
* error.c, error.h: Made error keys globally accessible.
Applications might want to test for these or use them in a direct
call to scm_error.
* 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.
2001-09-17 Dirk Herrmann <D.Herrmann@tu-bs.de> 2001-09-17 Dirk Herrmann <D.Herrmann@tu-bs.de>
The following patch partially undoes my patch from 2001-06-30, The following patch partially undoes my patch from 2001-06-30,

View file

@ -69,16 +69,6 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
return res; 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);
}
else else
scm_wrong_type_arg (s_caller, pos, num); scm_wrong_type_arg (s_caller, pos, num);
} }