OSDN Git Service

* gcc.dg/dfp/func-array.c: Support -DDBG to report individual failures.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / dfp / compare-eq-const.c
1 /* { dg-options "-std=gnu99" } */
2
3 /* C99 6.5.9 Equality operators.
4    Compare decimal float constants against each other. */
5
6 extern void link_error (void);
7
8 int
9 main ()
10 {
11   /* Compare like-typed positive constants. */
12   if (2.0df != 2.0df)
13     link_error ();
14
15   /* Compare decimal float constants of different types. */
16   if (500e-2dl != 0.05e2df)
17     link_error ();
18
19   /* Binary floating point introduces errors to decimal values. */
20   if (1.4 + 1.4 + 1.4 == 4.2)
21     link_error ();
22
23   /* But, this looks more like what one would expect. */
24   if (1.4dd + 1.4dd + 1.4dd != 4.2dd)
25     link_error ();
26
27   return 0;
28 }