1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

* numbers.c (mem2uinteger): Return number read so far when coming

across a hexdigit after having read a # or if not reading a hex
value.  This will enable the calling code to correctly handle
forms like 1e2.  (The background is, that the exponent markers d,
e and f are also hexdigits.)  Thanks to Mikael Djurfeldt for
providing this patch.

(mem2complex):  Fix erroneous double-negation.  Now, numbers like
1-i will be read correctly.
This commit is contained in:
Dirk Herrmann 2001-10-13 12:39:26 +00:00
parent b7d9b1cf5a
commit 1fe5e088ff
2 changed files with 17 additions and 7 deletions

View file

@ -1,3 +1,15 @@
2001-10-13 Dirk Herrmann <D.Herrmann@tu-bs.de>
* numbers.c (mem2uinteger): Return number read so far when coming
across a hexdigit after having read a # or if not reading a hex
value. This will enable the calling code to correctly handle
forms like 1e2. (The background is, that the exponent markers d,
e and f are also hexdigits.) Thanks to Mikael Djurfeldt for
providing this patch.
(mem2complex): Fix erroneous double-negation. Now, numbers like
1-i will be read correctly.
2001-10-12 Mikael Djurfeldt <mdj@linnaeus>
* debug.c (scm_mem_to_proc): Fixed typo in previous change.

View file

@ -2296,10 +2296,10 @@ mem2uinteger (const char* mem, size_t len, unsigned int *p_idx,
if (isxdigit (c))
{
if (hash_seen)
return SCM_BOOL_F;
break;
digit_value = XDIGIT2UINT (c);
if (digit_value >= radix)
return SCM_BOOL_F;
break;
}
else if (c == '#')
{
@ -2683,10 +2683,11 @@ mem2complex (const char* mem, size_t len, unsigned int idx,
{
int sign = (c == '+') ? 1 : -1;
SCM imag = mem2ureal (mem, len, &idx, radix, p_exactness);
SCM result;
if (SCM_FALSEP (imag))
imag = SCM_MAKINUM (sign);
else if (sign == -1)
imag = scm_difference (imag, SCM_UNDEFINED);
if (idx == len)
return SCM_BOOL_F;
@ -2697,10 +2698,7 @@ mem2complex (const char* mem, size_t len, unsigned int idx,
if (idx != len)
return SCM_BOOL_F;
if (sign == -1)
imag = scm_difference (imag, SCM_UNDEFINED);
result = scm_make_rectangular (ureal, imag);
return result;
return scm_make_rectangular (ureal, imag);
}
default:
return SCM_BOOL_F;