Json reports big integers as inf without double quotes leading to parse failure

Description

[root@centos json]# gcc trial.c
[root@centos json]# ./a.out 10000000000
long int: 10000000000
[root@centos json]# ./a.out 100000000000000000000
double: 100000000000000000000.000000
[root@centos json]# ./a.out 10000000000000000000000000000000000000000
double: 10000000000000000303786028427003666890752.000000
[root@centos json]# ./a.out 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
double: inf
[root@centos json]# cat trial.c
#include<stdio.h>
#include<stdlib.h>

main(int argc, char **argv) {
double val;
char *pc;
long int ivalue = 0;
void *value = argv[1];
if (value) {
val = strtod(value, &pc);
ivalue = (long int) val;
if (val == ivalue)
printf("long int: %ld\n", ivalue);
else
printf("double: %lf\n", (double)val);
}
return 0;
}
[root@centos json]#

https://www.exploringbinary.com/a-bug-in-the-bigcomp-function-of-david-gays-strtod/

Acceptance Criteria

None

Status

Assignee

Unassigned

Reporter

Nithin Johnson

Severity

None

OS

None

Start Date

None

Pull Request URL

None

Story Points

1

Priority

Low
Configure