1 /* Test compilation of tgmath macros.
2 Copyright (C) 2001 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Jakub Jelinek <jakub@redhat.com> and
5 Ulrich Drepper <drepper@redhat.com>, 2001.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If not,
19 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #undef __NO_MATH_INLINES
24 #define __NO_MATH_INLINES 1
31 static void compile_test (void);
32 static void compile_testf (void);
33 static void compile_testl (void);
50 count_float
= count_double
= count_ldouble
= 0;
54 puts ("float function called for double test");
57 if (count_ldouble
!= 0)
59 puts ("long double function called for double test");
62 if (count_double
< NCALLS
)
64 printf ("double functions not called often enough (%d)\n",
68 else if (count_double
> NCALLS
)
70 printf ("double functions called too often (%d)\n",
75 count_float
= count_double
= count_ldouble
= 0;
77 if (count_double
!= 0)
79 puts ("double function called for float test");
82 if (count_ldouble
!= 0)
84 puts ("long double function called for float test");
87 if (count_float
< NCALLS
)
89 printf ("float functions not called often enough (%d)\n", count_float
);
92 else if (count_float
> NCALLS
)
94 printf ("float functions called too often (%d)\n",
99 #ifndef NO_LONG_DOUBLE
100 count_float
= count_double
= count_ldouble
= 0;
102 if (count_float
!= 0)
104 puts ("float function called for long double test");
107 if (count_double
!= 0)
109 puts ("double function called for long double test");
112 if (count_ldouble
< NCALLS
)
114 printf ("long double functions not called often enough (%d)\n",
118 else if (count_ldouble
> NCALLS
)
120 printf ("long double functions called too often (%d)\n",
129 /* Now generate the three functions. */
135 #define count count_double
136 #include "test-tgmath.c"
138 #define F(name) name##f
141 #define count count_float
142 #include "test-tgmath.c"
144 #ifndef NO_LONG_DOUBLE
145 #define F(name) name##l
146 #define TYPE long double
148 #define count count_ldouble
149 #include "test-tgmath.c"
155 #define P() puts (__FUNCTION__)
161 F(compile_test
) (void)
174 c
= atan2 (atan2 (a
, c
), atan2 (b
, x
));
176 b
= acosh (acosh (a
));
178 b
= asinh (asinh (a
));
180 b
= atanh (atanh (a
));
183 a
= log10 (log10 (x
));
184 b
= ldexp (ldexp (a
, 1), 5);
185 a
= frexp (frexp (x
, &i
), &i
);
186 b
= expm1 (expm1 (a
));
187 a
= log1p (log1p (x
));
191 a
= pow (pow (x
, a
), pow (c
, b
));
193 a
= hypot (hypot (x
, b
), hypot (c
, a
));
197 a
= floor (floor (x
));
198 b
= fmod (fmod (a
, b
), fmod (c
, x
));
199 a
= nearbyint (nearbyint (x
));
200 b
= round (round (a
));
201 a
= trunc (trunc (x
));
202 b
= remquo (remquo (a
, b
, &i
), remquo (c
, x
, &i
), &i
);
203 j
= lrint (x
) + lround (a
);
204 k
= llrint (b
) + llround (c
);
207 a
= tgamma (tgamma (x
));
208 b
= lgamma (lgamma (a
));
210 b
= nextafter (nextafter (a
, b
), nextafter (c
, x
));
211 a
= nexttoward (nexttoward (x
, a
), c
);
212 b
= remainder (remainder (a
, b
), remainder (c
, x
));
213 a
= scalb (scalb (x
, a
), (TYPE
) (6));
214 k
= scalbn (a
, 7) + scalbln (c
, 10l);
216 a
= fdim (fdim (x
, a
), fdim (c
, b
));
217 b
= fmax (fmax (a
, x
), fmax (c
, b
));
218 a
= fmin (fmin (x
, a
), fmin (c
, b
));
219 b
= fma (sin (a
), sin (x
), sin (c
));
272 (F(atan2
)) (TYPE x
, TYPE y
)
352 (F(ldexp
)) (TYPE x
, int y
)
360 (F(frexp
)) (TYPE x
, int *y
)
408 (F(pow
)) (TYPE x
, TYPE y
)
424 (F(hypot
)) (TYPE x
, TYPE y
)
464 (F(fmod
)) (TYPE x
, TYPE y
)
472 (F(nearbyint
)) (TYPE x
)
496 (F(remquo
)) (TYPE x
, TYPE y
, int *i
)
528 (F(llround
)) (TYPE x
)
576 (F(nextafter
)) (TYPE x
, TYPE y
)
584 (F(nexttoward
)) (TYPE x
, long double y
)
592 (F(remainder
)) (TYPE x
, TYPE y
)
600 (F(scalb
)) (TYPE x
, TYPE y
)
608 (F(scalbn
)) (TYPE x
, int y
)
616 (F(scalbln
)) (TYPE x
, long int y
)
632 (F(fdim
)) (TYPE x
, TYPE y
)
640 (F(fmin
)) (TYPE x
, TYPE y
)
648 (F(fmax
)) (TYPE x
, TYPE y
)
656 (F(fma
)) (TYPE x
, TYPE y
, TYPE z
)