[Bug libc/23007] New: strtod cannot handle -nan
hermantenbrugge at home dot nl
sourceware-bugzilla@sourceware.org
Tue Mar 27 17:17:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=23007
Bug ID: 23007
Summary: strtod cannot handle -nan
Product: glibc
Version: 2.26
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: hermantenbrugge at home dot nl
CC: drepper.fsp at gmail dot com
Target Milestone: ---
The following code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int
main(void)
{
double d;
printf ("%g\n", strtod ("nan", NULL));
printf ("%g\n", strtod ("-nan", NULL));
sscanf ("nan", "%lg", &d); printf ("%g\n", d);
sscanf ("-nan", "%lg", &d); printf ("%g\n", d);
return 0;
}
produces after compiling and running:
nan
nan
nan
-nan
I was expecting the same result from strtod and sscanf for -nan.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list