OSDN Git Service

Merged with libbbid branch at revision 126349.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / dfp / nan-2.c
1 /* { dg-options "-std=gnu99" } */
2
3 /* N1150 4: Characteristics of decimal floating types (not explicit)
4    C99 5.2.4.2.2: Characteristics of floating types.
5    A few simple checks on arithmetic operations.  Based on nan-1.c with
6    the consideration of negative zero.  */
7
8 extern void abort (void);
9
10 int main()
11 {
12   _Decimal32 d32;
13   _Decimal64 d64;
14   _Decimal128 d128;
15
16   /* Verify that division by negative zero produces a negative infinity 
17      result.  */
18   d32 = 123.45f;
19   if (d32/-0.0df != -__builtin_infd32())
20     abort();
21   if (123.45df/-0.0df != -__builtin_infd32())
22     abort();
23   
24   d64 = 123.45f;
25   if (d64/-0.0dd != -__builtin_infd64())
26     abort();
27   if (123.45dd/-0.0dd !=  -__builtin_infd64())
28     abort();
29
30   d128 = 123.45f;
31   if (d128/-0.0dl != -__builtin_infd64())
32     abort();
33   if (123.45dl/-0.0dl != -__builtin_infd128())
34     abort();
35
36   d32 = 0.0df;
37   if (!__builtin_isnand32(-(d32/-0.0df)))
38     abort();
39   if (!__builtin_isnand32(-(0.0df/-0.0df)))
40     abort();
41
42   d64 = 0.0dd;
43   if (!__builtin_isnand64(-(d64/-0.0dd)))
44     abort();
45   if (!__builtin_isnand64(-(0.0dd/-0.0dd)))
46     abort();
47
48   d128 = 0.0dl;
49   if (!__builtin_isnand128(-(d128/-0.0dl)))
50     abort();
51   if (!__builtin_isnand128(-(0.0dl/-0.0dl)))
52     abort();
53
54   return 0;
55 }