Estimate real number underflows with 0.0

Earlier it was a decoding error.
This commit is contained in:
Petri Lehtinen 2010-03-26 21:59:53 +02:00
parent f76966b438
commit bb89a5d4d3
7 changed files with 3 additions and 12 deletions

View File

@ -483,14 +483,7 @@ static int lex_scan_number(lex_t *lex, char c, json_error_t *error)
value = strtod(saved_text, &end);
assert(end == saved_text + lex->saved_text.length);
if(value == 0 && errno == ERANGE) {
error_set(error, lex, "real number underflow");
goto out;
}
/* Cannot test for +/-HUGE_VAL because the HUGE_VAL constant is
only defined in C99 mode. So let's trust in sole errno. */
else if(errno == ERANGE) {
if(errno == ERANGE && value != 0) {
error_set(error, lex, "real number overflow");
goto out;
}

View File

@ -1,2 +0,0 @@
1
real number underflow near '123e-10000000'

View File

@ -1,2 +0,0 @@
1
real number underflow near '123e-10000000'

View File

@ -0,0 +1 @@
[0.0]

View File

@ -0,0 +1 @@
[0.0]