1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <errno.h>
4 #include <math.h>
5
main(int argc,char * argv[])6 int main(int argc, char *argv[])
7 {
8 int i;
9 float f;
10 double d;
11 long double ld;
12 char *eptr;
13
14 for (i = 1; i < argc; i++) {
15 errno = 0;
16 f = strtof(argv[i], &eptr);
17 f = nextafterf(f, INFINITY);
18 printf("%a (*eptr:%d errno:%d)\n", f, *eptr, errno);
19 errno = 0;
20 d = strtod(argv[i], &eptr);
21 d = nextafter(d, INFINITY);
22 printf("%a (*eptr:%d errno:%d)\n", d, *eptr, errno);
23 errno = 0;
24 ld = strtold(argv[i], &eptr);
25 ld = nextafterl(ld, INFINITY);
26 printf("%La (*eptr:%d errno:%d)\n", ld, *eptr, errno);
27 }
28 return 0;
29 }
30