Set errno for ±Inf.
[glibc/history.git] / math / test-tgmath-int.c
blob99ebe9f508c1ff61a6c980dd93cff179611368f1
1 /* Test compilation of tgmath macros.
2 Copyright (C) 2005 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Andreas Jaeger <aj@suse.de>, 2005.
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.
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.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #include <math.h>
22 #include <complex.h>
23 #include <tgmath.h>
24 #include <stdio.h>
26 static int errors = 0;
28 static void
29 our_error (const char *c)
31 puts (c);
32 ++errors;
35 #define CHECK_RET_CONST_TYPE(func, rettype, name) \
36 if (sizeof (func) != sizeof (rettype)) \
37 our_error ("Return size of " #name " is " #func" wrong");
39 #define CHECK_RET_CONST_FLOAT(func, name) \
40 CHECK_RET_CONST_TYPE (func, float, name)
42 #define CHECK_RET_CONST_DOUBLE(func, name) \
43 CHECK_RET_CONST_TYPE (func, double, name)
45 static int
46 do_test (void)
48 int i;
49 float f;
50 double d;
52 CHECK_RET_CONST_DOUBLE (sin (i), "sin (i)");
53 CHECK_RET_CONST_DOUBLE (pow (i, i), "pow (i, i)");
54 CHECK_RET_CONST_DOUBLE (pow (i, i), "pow (i, i)");
55 CHECK_RET_CONST_DOUBLE (pow (i, f), "pow (i, f)");
56 CHECK_RET_CONST_DOUBLE (pow (i, d), "pow (i, d)");
57 CHECK_RET_CONST_DOUBLE (pow (f, i), "pow (f, i)");
58 CHECK_RET_CONST_DOUBLE (pow (d, i), "pow (d, i)");
59 CHECK_RET_CONST_DOUBLE (fma (i, i, i), "fma (i, i, i)");
60 CHECK_RET_CONST_DOUBLE (fma (f, i, i), "fma (f, i, i)");
61 CHECK_RET_CONST_DOUBLE (fma (i, f, i), "fma (i, f, i)");
62 CHECK_RET_CONST_DOUBLE (fma (i, i, f), "fma (i, i, f)");
63 CHECK_RET_CONST_DOUBLE (fma (d, i, i), "fma (d, i, i)");
64 CHECK_RET_CONST_DOUBLE (fma (i, d, i), "fma (i, d, i)");
65 CHECK_RET_CONST_DOUBLE (fma (i, i, d), "fma (i, i, d)");
67 return errors != 0;
70 #define TEST_FUNCTION do_test ()
71 #include "../test-skeleton.c"