Debian Codegraph @

gcc/testsuite/gcc.dg/dfp/c23-decimal64x-4.c

raw
1 /* Test _Decimal64x in C23 mode - float.h macros. */
2 /* { dg-do run } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
4
5 #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
6 #define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
7 #endif
8
9 #include <float.h>
10
11 #define expr_has_type(e, t) _Generic (e, default : 0, t : 1)
12 static_assert (expr_has_type (DEC64X_MAX, _Decimal64x));
13 static_assert (expr_has_type (DEC64X_MIN, _Decimal64x));
14 static_assert (expr_has_type (DEC64X_EPSILON, _Decimal64x));
15 static_assert (expr_has_type (DEC64X_TRUE_MIN, _Decimal64x));
16
17 int
18 main ()
19 {
20 #if __DEC64X_MANT_DIG__ == __DEC128_MANT_DIG__ \
21 && __DEC64X_MAX_EXP__ == __DEC128_MAX_EXP__
22 if (DEC64X_MANT_DIG != 34)
23 __builtin_abort ();
24
25 if (DEC64X_MIN_EXP != -6142)
26 __builtin_abort ();
27
28 if (DEC64X_MAX_EXP != 6145)
29 __builtin_abort ();
30
31 if (DEC64X_MAX != 9.999999999999999999999999999999999E6144D64x)
32 __builtin_abort ();
33
34 if (DEC64X_EPSILON != 1E-33D64x)
35 __builtin_abort ();
36
37 if (DEC64X_MIN != 1E-6143D64x)
38 __builtin_abort ();
39
40 if (DEC64X_TRUE_MIN != 0.000000000000000000000000000000001E-6143D64x)
41 __builtin_abort ();
42 #endif
43 }