| @@ -394,26 +394,28 @@ char *setsval(Cell *vp, const char *s) / | | | @@ -394,26 +394,28 @@ char *setsval(Cell *vp, const char *s) / |
394 | | | 394 | |
395 | return(vp->sval); | | 395 | return(vp->sval); |
396 | } | | 396 | } |
397 | | | 397 | |
398 | static int checkstr(const char *s, const char *v) | | 398 | static int checkstr(const char *s, const char *v) |
399 | { | | 399 | { |
400 | while (*s && tolower((unsigned char)*s) == *v) | | 400 | while (*s && tolower((unsigned char)*s) == *v) |
401 | s++, v++; | | 401 | s++, v++; |
402 | return !(*s || *v); | | 402 | return !(*s || *v); |
403 | } | | 403 | } |
404 | | | 404 | |
405 | static int checkinfnan(const char *s) | | 405 | static int checkinfnan(const char *s) |
406 | { | | 406 | { |
| | | 407 | if (*s == '+' || *s == '-') |
| | | 408 | s++; |
407 | switch (tolower((unsigned char)*s)) { | | 409 | switch (tolower((unsigned char)*s)) { |
408 | case 'i': | | 410 | case 'i': |
409 | return checkstr(s, "inf") || checkstr(s, "infinity"); | | 411 | return checkstr(s, "inf") || checkstr(s, "infinity"); |
410 | case 'n': | | 412 | case 'n': |
411 | return checkstr(s, "nan"); | | 413 | return checkstr(s, "nan"); |
412 | default: | | 414 | default: |
413 | return 1; | | 415 | return 1; |
414 | } | | 416 | } |
415 | } | | 417 | } |
416 | | | 418 | |
417 | Awkfloat getfval(Cell *vp) /* get float val of a Cell */ | | 419 | Awkfloat getfval(Cell *vp) /* get float val of a Cell */ |
418 | { | | 420 | { |
419 | if ((vp->tval & (NUM | STR)) == 0) | | 421 | if ((vp->tval & (NUM | STR)) == 0) |