complex.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Copyright (C) 1997, 1998, 1999, 2000, 2006 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. /*
  16. * ISO C99: 7.3 Complex arithmetic <complex.h>
  17. */
  18. #ifndef _COMPLEX_H
  19. #define _COMPLEX_H 1
  20. #include <features.h>
  21. /* Get general and ISO C99 specific information. */
  22. #include <bits/mathdef.h>
  23. __BEGIN_DECLS
  24. /* We might need to add support for more compilers here. But since ISO
  25. C99 is out hopefully all maintained compilers will soon provide the data
  26. types `float complex' and `double complex'. */
  27. #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
  28. # define _Complex __complex__
  29. #endif
  30. #define complex _Complex
  31. /* Narrowest imaginary unit. This depends on the floating-point
  32. evaluation method.
  33. XXX This probably has to go into a gcc related file. */
  34. #define _Complex_I (__extension__ 1.0iF)
  35. /* Another more descriptive name is `I'.
  36. XXX Once we have the imaginary support switch this to _Imaginary_I. */
  37. #undef I
  38. #define I _Complex_I
  39. /* The file <bits/cmathcalls.h> contains the prototypes for all the
  40. actual math functions. These macros are used for those prototypes,
  41. so we can easily declare each function as both `name' and `__name',
  42. and can declare the float versions `namef' and `__namef'. */
  43. #define __MATHCALL(function, args) \
  44. __MATHDECL(_Mdouble_complex_,function, args)
  45. #define __MATHDECL(type, function, args) \
  46. __MATHDECL_1(type, function, args); \
  47. __MATHDECL_1(type, __CONCAT(__,function), args)
  48. #define __MATHDECL_1(type, function, args) \
  49. extern type __MATH_PRECNAME(function) args __THROW
  50. #define _Mdouble_ double
  51. #define __MATH_PRECNAME(name) name
  52. #include <bits/cmathcalls.h>
  53. #undef _Mdouble_
  54. #undef __MATH_PRECNAME
  55. /* Now the float versions. */
  56. #ifndef _Mfloat_
  57. # define _Mfloat_ float
  58. #endif
  59. #define _Mdouble_ _Mfloat_
  60. #ifdef __STDC__
  61. # define __MATH_PRECNAME(name) name##f
  62. #else
  63. # define __MATH_PRECNAME(name) name/**/f
  64. #endif
  65. #include <bits/cmathcalls.h>
  66. #undef _Mdouble_
  67. #undef __MATH_PRECNAME
  68. /* And the long double versions. It is non-critical to define them
  69. here unconditionally since `long double' is required in ISO C99. */
  70. #if (__STDC__ - 0 || __GNUC__ - 0) \
  71. && defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
  72. # ifndef _Mlong_double_
  73. # define _Mlong_double_ long double
  74. # endif
  75. # define _Mdouble_ _Mlong_double_
  76. # ifdef __STDC__
  77. # define __MATH_PRECNAME(name) name##l
  78. # else
  79. # define __MATH_PRECNAME(name) name/**/l
  80. # endif
  81. # include <bits/cmathcalls.h>
  82. #endif
  83. #undef _Mdouble_
  84. #undef __MATH_PRECNAME
  85. #undef __MATHDECL_1
  86. #undef __MATHDECL
  87. #undef __MATHCALL
  88. __END_DECLS
  89. #endif /* complex.h */