packaging: add 64bit libs on 32bit build env
[platform/upstream/linaro-glibc.git] / math / test-tgmath-int.c
1 /* Test compilation of tgmath macros.
2    Copyright (C) 2005-2014 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4    Contributed by Andreas Jaeger <aj@suse.de>, 2005.
5
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <http://www.gnu.org/licenses/>.  */
19
20 #include <math.h>
21 #include <complex.h>
22 #include <tgmath.h>
23 #include <stdio.h>
24
25 static int errors = 0;
26
27 static void
28 our_error (const char *c)
29 {
30   puts (c);
31   ++errors;
32 }
33
34 #define CHECK_RET_CONST_TYPE(func, rettype, name)                       \
35   if (sizeof (func) != sizeof (rettype))                                \
36     our_error ("Return size of " #name " is " #func" wrong");
37
38 #define CHECK_RET_CONST_FLOAT(func, name)               \
39   CHECK_RET_CONST_TYPE (func, float, name)
40
41 #define CHECK_RET_CONST_DOUBLE(func, name)              \
42   CHECK_RET_CONST_TYPE (func, double, name)
43
44 static int
45 do_test (void)
46 {
47   int i;
48   float f;
49   double d;
50
51   CHECK_RET_CONST_DOUBLE (sin (i), "sin (i)");
52   CHECK_RET_CONST_DOUBLE (pow (i, i), "pow (i, i)");
53   CHECK_RET_CONST_DOUBLE (pow (i, i), "pow (i, i)");
54   CHECK_RET_CONST_DOUBLE (pow (i, f), "pow (i, f)");
55   CHECK_RET_CONST_DOUBLE (pow (i, d), "pow (i, d)");
56   CHECK_RET_CONST_DOUBLE (pow (f, i), "pow (f, i)");
57   CHECK_RET_CONST_DOUBLE (pow (d, i), "pow (d, i)");
58   CHECK_RET_CONST_DOUBLE (fma (i, i, i), "fma (i, i, i)");
59   CHECK_RET_CONST_DOUBLE (fma (f, i, i), "fma (f, i, i)");
60   CHECK_RET_CONST_DOUBLE (fma (i, f, i), "fma (i, f, i)");
61   CHECK_RET_CONST_DOUBLE (fma (i, i, f), "fma (i, i, f)");
62   CHECK_RET_CONST_DOUBLE (fma (d, i, i), "fma (d, i, i)");
63   CHECK_RET_CONST_DOUBLE (fma (i, d, i), "fma (i, d, i)");
64   CHECK_RET_CONST_DOUBLE (fma (i, i, d), "fma (i, i, d)");
65
66   return errors != 0;
67 }
68
69 #define TEST_FUNCTION do_test ()
70 #include "../test-skeleton.c"