OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.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 #define __STDC_WANT_DEC_FP__ 1
11 #include <float.h>
12
13 extern void abort (void);
14
15 int main ()
16 {
17   if (DEC32_MANT_DIG != 7) abort();
18   if (DEC64_MANT_DIG != 16) abort();
19   if (DEC128_MANT_DIG != 34) abort();
20
21   if (DEC32_MIN_EXP != -95) abort();
22   if (DEC64_MIN_EXP != -383) abort();
23   if (DEC128_MIN_EXP != -6143) abort();
24
25   if (DEC32_MAX_EXP != 96) abort();
26   if (DEC64_MAX_EXP != 384) abort();
27   if (DEC128_MAX_EXP != 6144) abort();
28
29   if (DEC32_MAX != 9.999999E96DF) abort();
30   if (DEC64_MAX != 9.999999999999999E384DD) abort();
31   if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) abort();
32
33   if (DEC32_EPSILON != 1E-6DF) abort();
34   if (DEC64_EPSILON != 1E-15DD) abort();
35   if (DEC128_EPSILON != 1E-33DL) abort();
36   
37   if (DEC32_MIN != 1E-95DF) abort();
38   if (DEC64_MIN != 1E-383DD) abort();
39   if (DEC128_MIN != 1E-6143DL) abort();
40
41   if (DEC32_DEN != 0.000001E-95DF) abort();
42   if (DEC64_DEN != 0.000000000000001E-383DD) abort();
43   if (DEC128_DEN != 0.000000000000000000000000000000001E-6143DL) abort();
44
45   return 0;
46 }