benchmark inputs for tanh and atanh
[glibc.git] / stdio-common / bug22.c
blobb26399acb7dfc775887b366692050f6e478d5e1f
1 /* BZ #5424 */
2 #include <stdio.h>
3 #include <errno.h>
5 /* INT_MAX + 1 */
6 #define N 2147483648
8 /* (INT_MAX / 2) + 2 */
9 #define N2 1073741825
11 /* INT_MAX - 3 */
12 #define N3 2147483644
14 #define STRINGIFY(S) #S
15 #define MAKE_STR(S) STRINGIFY(S)
17 #define SN MAKE_STR(N)
18 #define SN2 MAKE_STR(N2)
19 #define SN3 MAKE_STR(N3)
21 static int
22 do_test (void)
24 int ret;
26 FILE *fp = fopen ("/dev/null", "w");
27 if (fp == NULL)
29 puts ("cannot open /dev/null");
30 return 1;
33 ret = fprintf (fp, "%" SN "d", 1);
34 printf ("ret = %d\n", ret);
35 if (ret != -1 || errno != EOVERFLOW)
36 return 1;
38 ret = fprintf (fp, "%." SN "d", 1);
39 printf ("ret = %d\n", ret);
40 if (ret != -1 || errno != EOVERFLOW)
41 return 1;
43 ret = fprintf (fp, "%." SN3 "d", 1);
44 printf ("ret = %d\n", ret);
45 if (ret != -1 || errno != EOVERFLOW)
46 return 1;
48 ret = fprintf (fp, "%" SN2 "d%" SN2 "d", 1, 1);
49 printf ("ret = %d\n", ret);
51 return ret != -1 || errno != EOVERFLOW;
54 #define TIMEOUT 60
55 #define TEST_FUNCTION do_test ()
56 #include "../test-skeleton.c"