2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / c-c++-common / dfp / nan-2.c
blobec9d18e10000f2e370b7bcb09230389a3cac59af
1 /* N1150 4: Characteristics of decimal floating types (not explicit)
2 C99 5.2.4.2.2: Characteristics of floating types.
3 A few simple checks on arithmetic operations. Based on nan-1.c with
4 the consideration of negative zero. */
6 #include "dfp-dbg.h"
8 int main()
10 _Decimal32 d32;
11 _Decimal64 d64;
12 _Decimal128 d128;
14 /* Verify that division by negative zero produces a negative infinity
15 result. */
16 d32 = 123.45f;
17 if (d32/-0.0df != -__builtin_infd32())
18 FAILURE
19 if (123.45df/-0.0df != -__builtin_infd32())
20 FAILURE
22 d64 = 123.45f;
23 if (d64/-0.0dd != -__builtin_infd64())
24 FAILURE
25 if (123.45dd/-0.0dd != -__builtin_infd64())
26 FAILURE
28 d128 = 123.45f;
29 if (d128/-0.0dl != -__builtin_infd64())
30 FAILURE
31 if (123.45dl/-0.0dl != -__builtin_infd128())
32 FAILURE
34 d32 = 0.0df;
35 if (!__builtin_isnand32(-(d32/-0.0df)))
36 FAILURE
37 if (!__builtin_isnand32(-(0.0df/-0.0df)))
38 FAILURE
40 d64 = 0.0dd;
41 if (!__builtin_isnand64(-(d64/-0.0dd)))
42 FAILURE
43 if (!__builtin_isnand64(-(0.0dd/-0.0dd)))
44 FAILURE
46 d128 = 0.0dl;
47 if (!__builtin_isnand128(-(d128/-0.0dl)))
48 FAILURE
49 if (!__builtin_isnand128(-(0.0dl/-0.0dl)))
50 FAILURE
52 FINISH