• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/lib/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/include-fixed/
1/*  DO NOT EDIT THIS FILE.
2
3    It has been auto-edited by fixincludes from:
4
5	"/projects/hnd/tools/linux/hndtools-arm-linux-2.6.36-uclibc-4.5.3/arm-brcm-linux-uclibcgnueabi/sysroot/usr/include/tgmath.h"
6
7    This had to be done to correct non-standard usages in the
8    original, manufacturer supplied header file.  */
9
10/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
11   This file is part of the GNU C Library.
12
13   The GNU C Library is free software; you can redistribute it and/or
14   modify it under the terms of the GNU Lesser General Public
15   License as published by the Free Software Foundation; either
16   version 2.1 of the License, or (at your option) any later version.
17
18   The GNU C Library is distributed in the hope that it will be useful,
19   but WITHOUT ANY WARRANTY; without even the implied warranty of
20   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21   Lesser General Public License for more details.
22
23   You should have received a copy of the GNU Lesser General Public
24   License along with the GNU C Library; if not, write to the Free
25   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26   02111-1307 USA.  */
27
28/*
29 *	ISO C99 Standard: 7.22 Type-generic math	<tgmath.h>
30 */
31
32#ifndef _TGMATH_H
33#define _TGMATH_H	1
34
35/* Include the needed headers.  */
36#include <math.h>
37#include <complex.h>
38
39
40/* Since `complex' is currently not really implemented in most C compilers
41   and if it is implemented, the implementations differ.  This makes it
42   quite difficult to write a generic implementation of this header.  We
43   do not try this for now and instead concentrate only on GNU CC.  Once
44   we have more information support for other compilers might follow.  */
45
46#if __GNUC_PREREQ (2, 7)
47
48# ifdef __NO_LONG_DOUBLE_MATH
49#  define __tgml(fct) fct
50# else
51#  define __tgml(fct) fct ## l
52# endif
53
54/* This is ugly but unless gcc gets appropriate builtins we have to do
55   something like this.  Don't ask how it works.  */
56
57/* 1 if 'type' is a floating type, 0 if 'type' is an integer type.
58   Allows for _Bool.  Expands to an integer constant expression.  */
59# define __floating_type(type) (__builtin_classify_type ((type) 0) == 8 || (__builtin_classify_type ((type) 0) == 9 && __builtin_classify_type (__real__ ((type) 0)) == 8))
60
61/* The tgmath real type for T, where E is 0 if T is an integer type and
62   1 for a floating type.  */
63# define __tgmath_real_type_sub(T, E) \
64  __typeof__(*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0	      \
65		 : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0))
66
67/* The tgmath real type of EXPR.  */
68# define __tgmath_real_type(expr) \
69  __tgmath_real_type_sub(__typeof__(expr), __floating_type(__typeof__(expr)))
70
71
72/* We have two kinds of generic macros: to support functions which are
73   only defined on real valued parameters and those which are defined
74   for complex functions as well.  */
75# define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
76     (__extension__ ({ __tgmath_real_type (Val) __tgmres;		      \
77		       if (sizeof (Val) == sizeof (double)		      \
78			   || __builtin_classify_type (Val) != 8)	      \
79			 __tgmres = Fct (Val);				      \
80		       else if (sizeof (Val) == sizeof (float))		      \
81			 __tgmres = Fct##f (Val);			      \
82		       else						      \
83			 __tgmres = __tgml(Fct) (Val);			      \
84		       __tgmres; }))
85
86# define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
87     (__extension__ ({ __tgmath_real_type (Val1) __tgmres;		      \
88		       if (sizeof (Val1) == sizeof (double)		      \
89			   || __builtin_classify_type (Val1) != 8)	      \
90			 __tgmres = Fct (Val1, Val2);			      \
91		       else if (sizeof (Val1) == sizeof (float))	      \
92			 __tgmres = Fct##f (Val1, Val2);		      \
93		       else						      \
94			 __tgmres = __tgml(Fct) (Val1, Val2);		      \
95		       __tgmres; }))
96
97# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
98     (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres;	      \
99		       if ((sizeof (Val1) > sizeof (double)		      \
100			    || sizeof (Val2) > sizeof (double))		      \
101			   && __builtin_classify_type ((Val1) + (Val2)) == 8) \
102			 __tgmres = __tgml(Fct) (Val1, Val2);		      \
103		       else if (sizeof (Val1) == sizeof (double)	      \
104				|| sizeof (Val2) == sizeof (double)	      \
105				|| __builtin_classify_type (Val1) != 8	      \
106				|| __builtin_classify_type (Val2) != 8)	      \
107			 __tgmres = Fct (Val1, Val2);			      \
108		       else						      \
109			 __tgmres = Fct##f (Val1, Val2);		      \
110		       __tgmres; }))
111
112# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
113     (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres;	      \
114		       if ((sizeof (Val1) > sizeof (double)		      \
115			    || sizeof (Val2) > sizeof (double))		      \
116			   && __builtin_classify_type ((Val1) + (Val2)) == 8) \
117			 __tgmres = __tgml(Fct) (Val1, Val2, Val3);	      \
118		       else if (sizeof (Val1) == sizeof (double)	      \
119				|| sizeof (Val2) == sizeof (double)	      \
120				|| __builtin_classify_type (Val1) != 8	      \
121				|| __builtin_classify_type (Val2) != 8)	      \
122			 __tgmres = Fct (Val1, Val2, Val3);		      \
123		       else						      \
124			 __tgmres = Fct##f (Val1, Val2, Val3);		      \
125		       __tgmres; }))
126
127# define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
128     (__extension__ ({ __tgmath_real_type ((Val1) + (Val2) + (Val3)) __tgmres;\
129		       if ((sizeof (Val1) > sizeof (double)		      \
130			    || sizeof (Val2) > sizeof (double)		      \
131			    || sizeof (Val3) > sizeof (double))		      \
132			   && __builtin_classify_type ((Val1) + (Val2)	      \
133						       + (Val3)) == 8)	      \
134			 __tgmres = __tgml(Fct) (Val1, Val2, Val3);	      \
135		       else if (sizeof (Val1) == sizeof (double)	      \
136				|| sizeof (Val2) == sizeof (double)	      \
137				|| sizeof (Val3) == sizeof (double)	      \
138				|| __builtin_classify_type (Val1) != 8	      \
139				|| __builtin_classify_type (Val2) != 8	      \
140				|| __builtin_classify_type (Val3) != 8)	      \
141			 __tgmres = Fct (Val1, Val2, Val3);		      \
142		       else						      \
143			 __tgmres = Fct##f (Val1, Val2, Val3);		      \
144		       __tgmres; }))
145
146/* XXX This definition has to be changed as soon as the compiler understands
147   the imaginary keyword.  */
148# define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
149     (__extension__ ({ __tgmath_real_type (Val) __tgmres;		      \
150		       if (sizeof (__real__ (Val)) > sizeof (double)	      \
151			   && __builtin_classify_type (__real__ (Val)) == 8)  \
152			 {						      \
153			   if (sizeof (__real__ (Val)) == sizeof (Val))	      \
154			     __tgmres = __tgml(Fct) (Val);		      \
155			   else						      \
156			     __tgmres = __tgml(Cfct) (Val);		      \
157			 }						      \
158		       else if (sizeof (__real__ (Val)) == sizeof (double)    \
159				|| __builtin_classify_type (__real__ (Val))   \
160				   != 8)				      \
161			 {						      \
162			   if (sizeof (__real__ (Val)) == sizeof (Val))	      \
163			     __tgmres = Fct (Val);			      \
164			   else						      \
165			     __tgmres = Cfct (Val);			      \
166			 }						      \
167		       else						      \
168			 {						      \
169			   if (sizeof (__real__ (Val)) == sizeof (Val))	      \
170			     __tgmres = Fct##f (Val);			      \
171			   else						      \
172			     __tgmres = Cfct##f (Val);			      \
173			 }						      \
174		       __tgmres; }))
175
176/* XXX This definition has to be changed as soon as the compiler understands
177   the imaginary keyword.  */
178# define __TGMATH_UNARY_IMAG_ONLY(Val, Fct) \
179     (__extension__ ({ __tgmath_real_type (Val) __tgmres;		      \
180		       if (sizeof (Val) == sizeof (__complex__ double)	      \
181			   || __builtin_classify_type (__real__ (Val)) != 8)  \
182			 __tgmres = Fct (Val);				      \
183		       else if (sizeof (Val) == sizeof (__complex__ float))   \
184			 __tgmres = Fct##f (Val);			      \
185		       else						      \
186			 __tgmres = __tgml(Fct) (Val);			      \
187		       __tgmres; }))
188
189/* XXX This definition has to be changed as soon as the compiler understands
190   the imaginary keyword.  */
191# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
192     (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres;	      \
193		       if ((sizeof (__real__ (Val1)) > sizeof (double)	      \
194			    || sizeof (__real__ (Val2)) > sizeof (double))    \
195			   && __builtin_classify_type (__real__ (Val1)	      \
196						       + __real__ (Val2))     \
197			      == 8)					      \
198			 {						      \
199			   if (sizeof (__real__ (Val1)) == sizeof (Val1)      \
200			       && sizeof (__real__ (Val2)) == sizeof (Val2))  \
201			     __tgmres = __tgml(Fct) (Val1, Val2);	      \
202			   else						      \
203			     __tgmres = __tgml(Cfct) (Val1, Val2);	      \
204			 }						      \
205		       else if (sizeof (__real__ (Val1)) == sizeof (double)   \
206				|| sizeof (__real__ (Val2)) == sizeof(double) \
207				|| (__builtin_classify_type (__real__ (Val1)) \
208				    != 8)				      \
209				|| (__builtin_classify_type (__real__ (Val2)) \
210				    != 8))				      \
211			 {						      \
212			   if (sizeof (__real__ (Val1)) == sizeof (Val1)      \
213			       && sizeof (__real__ (Val2)) == sizeof (Val2))  \
214			     __tgmres = Fct (Val1, Val2);		      \
215			   else						      \
216			     __tgmres = Cfct (Val1, Val2);		      \
217			 }						      \
218		       else						      \
219			 {						      \
220			   if (sizeof (__real__ (Val1)) == sizeof (Val1)      \
221			       && sizeof (__real__ (Val2)) == sizeof (Val2))  \
222			     __tgmres = Fct##f (Val1, Val2);		      \
223			   else						      \
224			     __tgmres = Cfct##f (Val1, Val2);		      \
225			 }						      \
226		       __tgmres; }))
227#else
228# error "Unsupported compiler; you cannot use <tgmath.h>"
229#endif
230
231
232/* Unary functions defined for real and complex values.  */
233
234
235/* Trigonometric functions.  */
236
237/* Arc cosine of X.  */
238#define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos)
239/* Arc sine of X.  */
240#define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin)
241/* Arc tangent of X.  */
242#define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan)
243/* Arc tangent of Y/X.  */
244#define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2)
245
246/* Cosine of X.  */
247#define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos)
248/* Sine of X.  */
249#define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin)
250/* Tangent of X.  */
251#define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan)
252
253
254/* Hyperbolic functions.  */
255
256/* Hyperbolic arc cosine of X.  */
257#define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh)
258/* Hyperbolic arc sine of X.  */
259#define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh)
260/* Hyperbolic arc tangent of X.  */
261#define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh)
262
263/* Hyperbolic cosine of X.  */
264#define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh)
265/* Hyperbolic sine of X.  */
266#define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh)
267/* Hyperbolic tangent of X.  */
268#define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh)
269
270
271/* Exponential and logarithmic functions.  */
272
273/* Exponential function of X.  */
274#define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp)
275
276/* Break VALUE into a normalized fraction and an integral power of 2.  */
277#define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp)
278
279/* X times (two to the EXP power).  */
280#define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp)
281
282/* Natural logarithm of X.  */
283#define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog)
284
285/* Base-ten logarithm of X.  */
286#ifdef __USE_GNU
287# define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10)
288#else
289# define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10)
290#endif
291
292/* Return exp(X) - 1.  */
293#define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)
294
295/* Return log(1 + X).  */
296#define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p)
297
298/* Return the base 2 signed integral exponent of X.  */
299#define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb)
300
301/* Compute base-2 exponential of X.  */
302#define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2)
303
304/* Compute base-2 logarithm of X.  */
305#define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2)
306
307
308/* Power functions.  */
309
310/* Return X to the Y power.  */
311#define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)
312
313/* Return the square root of X.  */
314#define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)
315
316/* Return `sqrt(X*X + Y*Y)'.  */
317#define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)
318
319/* Return the cube root of X.  */
320#define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)
321
322
323/* Nearest integer, absolute value, and remainder functions.  */
324
325/* Smallest integral value not less than X.  */
326#define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
327
328/* Absolute value of X.  */
329#define fabs(Val) __TGMATH_UNARY_REAL_IMAG (Val, fabs, cabs)
330
331/* Largest integer not greater than X.  */
332#define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
333
334/* Floating-point modulo remainder of X/Y.  */
335#define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod)
336
337/* Round X to integral valuein floating-point format using current
338   rounding direction, but do not raise inexact exception.  */
339#define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint)
340
341/* Round X to nearest integral value, rounding halfway cases away from
342   zero.  */
343#define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round)
344
345/* Round X to the integral value in floating-point format nearest but
346   not larger in magnitude.  */
347#define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc)
348
349/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
350   and magnitude congruent `mod 2^n' to the magnitude of the integral
351   quotient x/y, with n >= 3.  */
352#define remquo(Val1, Val2, Val3) \
353     __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo)
354
355/* Round X to nearest integral value according to current rounding
356   direction.  */
357#define lrint(Val) __TGMATH_UNARY_REAL_ONLY (Val, lrint)
358#define llrint(Val) __TGMATH_UNARY_REAL_ONLY (Val, llrint)
359
360/* Round X to nearest integral value, rounding halfway cases away from
361   zero.  */
362#define lround(Val) __TGMATH_UNARY_REAL_ONLY (Val, lround)
363#define llround(Val) __TGMATH_UNARY_REAL_ONLY (Val, llround)
364
365
366/* Return X with its signed changed to Y's.  */
367#define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign)
368
369/* Error and gamma functions.  */
370#define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf)
371#define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc)
372#define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma)
373#define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma)
374
375
376/* Return the integer nearest X in the direction of the
377   prevailing rounding mode.  */
378#define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
379
380/* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
381#define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
382#define nexttoward(Val1, Val2) \
383     __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, nexttoward)
384
385/* Return the remainder of integer divison X / Y with infinite precision.  */
386#define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
387
388#if defined __UCLIBC_SUSV3_LEGACY__
389/* Return X times (2 to the Nth power).  */
390#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
391# define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb)
392#endif
393
394/* Return X times (2 to the Nth power).  */
395#define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn)
396
397/* Return X times (2 to the Nth power).  */
398#define scalbln(Val1, Val2) \
399     __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
400#endif /* UCLIBC_SUSV3_LEGACY */
401
402/* Return the binary exponent of X, which must be nonzero.  */
403#define ilogb(Val) __TGMATH_UNARY_REAL_ONLY (Val, ilogb)
404
405
406/* Return positive difference between X and Y.  */
407#define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim)
408
409/* Return maximum numeric value from X and Y.  */
410#define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
411
412/* Return minimum numeric value from X and Y.  */
413#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
414
415
416/* Multiply-add function computed as a ternary operation.  */
417#define fma(Val1, Val2, Val3) \
418     __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma)
419
420
421/* Absolute value, conjugates, and projection.  */
422
423/* Argument value of Z.  */
424#define carg(Val) __TGMATH_UNARY_IMAG_ONLY (Val, carg)
425
426/* Complex conjugate of Z.  */
427#define conj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, conj)
428
429/* Projection of Z onto the Riemann sphere.  */
430#define cproj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cproj)
431
432
433/* Decomposing complex values.  */
434
435/* Imaginary part of Z.  */
436#define cimag(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cimag)
437
438/* Real part of Z.  */
439#define creal(Val) __TGMATH_UNARY_IMAG_ONLY (Val, creal)
440
441#endif /* tgmath.h */
442