Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / sinatan-1.c
blobcfbb771a018d3175c680dce88e0121e469716edc
1 /* { dg-do run { target c99_runtime } } */
2 /* { dg-options "-Ofast" } */
3 /* { dg-add-options ieee } */
5 extern float sinf (float);
6 extern float cosf (float);
7 extern float atanf (float);
8 extern float sqrtf (float);
9 extern float nextafterf (float, float);
10 extern double sin (double);
11 extern double cos (double);
12 extern double atan (double);
13 extern double sqrt (double);
14 extern double nextafter (double, double);
15 extern long double sinl (long double);
16 extern long double cosl (long double);
17 extern long double atanl (long double);
18 extern long double sqrtl (long double);
19 extern long double nextafterl (long double, long double);
21 extern void abort ();
23 double __attribute__ ((noinline, optimize("Ofast")))
24 sinatan (double x)
26 return sin (atan (x));
29 double __attribute__ ((noinline, optimize("Ofast")))
30 cosatan (double x)
32 return cos (atan (x));
35 float __attribute__ ((noinline, optimize("Ofast")))
36 sinatanf(float x)
38 return sinf (atanf (x));
41 float __attribute__ ((noinline, optimize("Ofast")))
42 cosatanf(float x)
44 return cosf (atanf (x));
47 long double __attribute__ ((noinline, optimize("Ofast")))
48 sinatanl (long double x)
50 return sinl (atanl (x));
53 long double __attribute__ ((noinline, optimize("Ofast")))
54 cosatanl (long double x)
56 return cosl (atanl (x));
59 int
60 main()
62 /* Get first x such that 1 + x*x will overflow */
63 float fc = nextafterf (sqrtf (__FLT_MAX__ - 1), __FLT_MAX__);
64 double c = nextafter (sqrt (__DBL_MAX__ - 1), __DBL_MAX__);
65 long double lc = nextafterl (sqrtl (__LDBL_MAX__ - 1), __LDBL_MAX__);
67 /* Force move from FPU to memory, otherwise comparison may
68 fail due to possible more accurate registers (see 387) */
69 volatile float fy;
70 volatile double y;
71 volatile long double ly;
73 fy = sinatanf (fc);
74 y = sinatan (c);
75 ly = sinatanl (lc);
77 if (fy != 1.f || y != 1 || ly != 1.L)
78 abort ();
80 fy = cosatanf (fc);
81 y = cosatan (c);
82 ly = cosatanl (lc);
84 if (fy != 0.f || y != 0. || ly != 0.L)
85 abort ();
87 fy = sinatanf (-fc);
88 y = sinatan (-c);
89 ly = sinatanl (-lc);
91 if (fy != -1.f || y != -1. || ly != -1.L)
92 abort ();
94 fy = cosatanf (-fc);
95 y = cosatan (-c);
96 ly = cosatanl (-lc);
98 if (fy != 0.f || y != 0. || ly != 0.L)
99 abort ();
101 return 0;