]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/dfp/decfloat-constants.c
Add BID decimal support
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / dfp / decfloat-constants.c
1 /* { dg-options "-std=gnu99" } */
2
3 /* N1150 4: Characteristics of decimal floating types <float.h>.
4 C99 5.2.4.2.2a[3]: New.
5
6 Verify constants about range of decimal float and three components of
7 decimal float defined in float.h. */
8
9 /* Make sure we are exporting the right values to float.h. */
10 #ifndef __STDC_WANT_DEC_FP__
11 #define __STDC_WANT_DEC_FP__ 1
12 #endif
13
14 #include <float.h>
15
16 extern void abort (void);
17
18 int main ()
19 {
20 if (DEC32_MANT_DIG != 7) abort();
21 if (DEC64_MANT_DIG != 16) abort();
22 if (DEC128_MANT_DIG != 34) abort();
23
24 if (DEC32_MIN_EXP != -95) abort();
25 if (DEC64_MIN_EXP != -383) abort();
26 if (DEC128_MIN_EXP != -6143) abort();
27
28 if (DEC32_MAX_EXP != 96) abort();
29 if (DEC64_MAX_EXP != 384) abort();
30 if (DEC128_MAX_EXP != 6144) abort();
31
32 if (DEC32_MAX != 9.999999E96DF) abort();
33 if (DEC64_MAX != 9.999999999999999E384DD) abort();
34 if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) abort();
35
36 if (DEC32_EPSILON != 1E-6DF) abort();
37 if (DEC64_EPSILON != 1E-15DD) abort();
38 if (DEC128_EPSILON != 1E-33DL) abort();
39
40 if (DEC32_MIN != 1E-95DF) abort();
41 if (DEC64_MIN != 1E-383DD) abort();
42 if (DEC128_MIN != 1E-6143DL) abort();
43
44 if (DEC32_DEN != 0.000001E-95DF) abort();
45 if (DEC64_DEN != 0.000000000000001E-383DD) abort();
46 if (DEC128_DEN != 0.000000000000000000000000000000001E-6143DL) abort();
47
48 return 0;
49 }