parent
d4a7de7c11
commit
fa20e80860
@ -2,6 +2,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
#include "jansson_private.h"
|
#include "jansson_private.h"
|
||||||
#include "strbuffer.h"
|
#include "strbuffer.h"
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ int jsonp_strtod(strbuffer_t *strbuffer, double *out)
|
|||||||
value = strtod(strbuffer->value, &end);
|
value = strtod(strbuffer->value, &end);
|
||||||
assert(end == strbuffer->value + strbuffer->length);
|
assert(end == strbuffer->value + strbuffer->length);
|
||||||
|
|
||||||
if(errno == ERANGE && value != 0) {
|
if((value == HUGE_VAL || value == -HUGE_VAL) && errno == ERANGE) {
|
||||||
/* Overflow */
|
/* Overflow */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
1
test/suites/valid/real-subnormal-number/input
Normal file
1
test/suites/valid/real-subnormal-number/input
Normal file
@ -0,0 +1 @@
|
|||||||
|
[1.8011670033376514e-308]
|
1
test/suites/valid/real-subnormal-number/output
Normal file
1
test/suites/valid/real-subnormal-number/output
Normal file
@ -0,0 +1 @@
|
|||||||
|
[1.8011670033376514e-308]
|
Loading…
Reference in New Issue
Block a user