fixing ambiguity in reading hex numbers and floating point

making print robust against the undefined value
This commit is contained in:
JeffBezanson 2009-02-24 18:31:05 +00:00
parent 115b2843fb
commit 7883a5de0b
2 changed files with 3 additions and 1 deletions

View File

@ -375,6 +375,7 @@ void fl_print_child(ios_t *f, value_t v, int princ)
break;
case TAG_CVALUE:
case TAG_CPRIM:
if (v == UNBOUND) { HPOS+=ios_printf(f, "#<undefined>"); break; }
case TAG_VECTOR:
case TAG_CONS:
if ((label=(value_t)ptrhash_get(&printconses, (void*)v)) !=

View File

@ -26,7 +26,8 @@ static int isnumtok_base(char *tok, value_t *pval, int base)
double d;
if (*tok == '\0')
return 0;
if (strpbrk(tok, ".eEpP")) {
if (!((tok[0]=='0' && tok[1]=='x') || (base >= 15)) &&
strpbrk(tok, ".eEpP")) {
d = strtod(tok, &end);
if (*end == '\0') {
if (pval) *pval = mk_double(d);