Add tests for errno after sin/cos calls with ±Inf.
[glibc/history.git] / stdlib / tst-strtod6.c
blobfdb104f9ca1df89bf6a51527fa4b471ee9bcb093
1 #include <math.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
6 static int
7 do_test (void)
9 static const char str[] = "NaN(blabla)something";
10 char *endp;
11 int result = 0;
13 double d = strtod (str, &endp);
14 if (!isnan (d))
16 puts ("strtod did not return NAN");
17 result = 1;
19 if (strcmp (endp, "something") != 0)
21 puts ("strtod set incorrect end pointer");
22 result = 1;
25 float f = strtof (str, &endp);
26 if (!isnanf (f))
28 puts ("strtof did not return NAN");
29 result = 1;
31 if (strcmp (endp, "something") != 0)
33 puts ("strtof set incorrect end pointer");
34 result = 1;
37 long double ld = strtold (str, &endp);
38 if (!isnan (ld))
40 puts ("strtold did not return NAN");
41 result = 1;
43 if (strcmp (endp, "something") != 0)
45 puts ("strtold set incorrect end pointer");
46 result = 1;
49 return result;
52 #define TEST_FUNCTION do_test ()
53 #include "../test-skeleton.c"