Blame math/complex.h

Packit 6c4009
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 *	ISO C99:  7.3 Complex arithmetic	<complex.h>
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef _COMPLEX_H
Packit 6c4009
#define _COMPLEX_H	1
Packit 6c4009
Packit 6c4009
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
Packit 6c4009
#include <bits/libc-header-start.h>
Packit 6c4009
Packit 6c4009
/* Get general and ISO C99 specific information.  */
Packit 6c4009
#include <bits/mathdef.h>
Packit 6c4009
Packit 6c4009
/* Gather machine-dependent _FloatN type support.  */
Packit 6c4009
#include <bits/floatn.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
/* We might need to add support for more compilers here.  But since ISO
Packit 6c4009
   C99 is out hopefully all maintained compilers will soon provide the data
Packit 6c4009
   types `float complex' and `double complex'.  */
Packit 6c4009
#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
Packit 6c4009
# define _Complex __complex__
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#define complex		_Complex
Packit 6c4009
Packit 6c4009
/* Narrowest imaginary unit.  This depends on the floating-point
Packit 6c4009
   evaluation method.
Packit 6c4009
   XXX This probably has to go into a gcc related file.  */
Packit 6c4009
#define _Complex_I	(__extension__ 1.0iF)
Packit 6c4009
Packit 6c4009
/* Another more descriptive name is `I'.
Packit 6c4009
   XXX Once we have the imaginary support switch this to _Imaginary_I.  */
Packit 6c4009
#undef I
Packit 6c4009
#define I _Complex_I
Packit 6c4009
Packit 6c4009
#if defined __USE_ISOC11 && __GNUC_PREREQ (4, 7)
Packit 6c4009
/* Macros to expand into expression of specified complex type.  */
Packit 6c4009
# define CMPLX(x, y) __builtin_complex ((double) (x), (double) (y))
Packit 6c4009
# define CMPLXF(x, y) __builtin_complex ((float) (x), (float) (y))
Packit 6c4009
# define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# define CMPLXF16(x, y) __builtin_complex ((_Float16) (x), (_Float16) (y))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# define CMPLXF32(x, y) __builtin_complex ((_Float32) (x), (_Float32) (y))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# define CMPLXF64(x, y) __builtin_complex ((_Float64) (x), (_Float64) (y))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# define CMPLXF128(x, y) __builtin_complex ((_Float128) (x), (_Float128) (y))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# define CMPLXF32X(x, y) __builtin_complex ((_Float32x) (x), (_Float32x) (y))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# define CMPLXF64X(x, y) __builtin_complex ((_Float64x) (x), (_Float64x) (y))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# define CMPLXF128X(x, y)					\
Packit 6c4009
  __builtin_complex ((_Float128x) (x), (_Float128x) (y))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* The file <bits/cmathcalls.h> contains the prototypes for all the
Packit 6c4009
   actual math functions.  These macros are used for those prototypes,
Packit 6c4009
   so we can easily declare each function as both `name' and `__name',
Packit 6c4009
   and can declare the float versions `namef' and `__namef'.  */
Packit 6c4009
Packit 6c4009
#define __MATHCALL(function, args)	\
Packit 6c4009
  __MATHDECL (_Mdouble_complex_,function, args)
Packit 6c4009
#define __MATHDECL(type, function, args) \
Packit 6c4009
  __MATHDECL_1(type, function, args); \
Packit 6c4009
  __MATHDECL_1(type, __CONCAT(__,function), args)
Packit 6c4009
#define __MATHDECL_1(type, function, args) \
Packit 6c4009
  extern type __MATH_PRECNAME(function) args __THROW
Packit 6c4009
Packit 6c4009
#define _Mdouble_ 		double
Packit 6c4009
#define __MATH_PRECNAME(name)	name
Packit 6c4009
#include <bits/cmathcalls.h>
Packit 6c4009
#undef	_Mdouble_
Packit 6c4009
#undef	__MATH_PRECNAME
Packit 6c4009
Packit 6c4009
/* Now the float versions.  */
Packit 6c4009
#define _Mdouble_ 		float
Packit 6c4009
#define __MATH_PRECNAME(name)	name##f
Packit 6c4009
#include <bits/cmathcalls.h>
Packit 6c4009
#undef	_Mdouble_
Packit 6c4009
#undef	__MATH_PRECNAME
Packit 6c4009
Packit 6c4009
/* And the long double versions.  It is non-critical to define them
Packit 6c4009
   here unconditionally since `long double' is required in ISO C99.  */
Packit 6c4009
#if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC)	\
Packit 6c4009
    || defined __LDBL_COMPAT
Packit 6c4009
# ifdef __LDBL_COMPAT
Packit 6c4009
#  undef __MATHDECL_1
Packit 6c4009
#  define __MATHDECL_1(type, function, args) \
Packit 6c4009
  extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function)
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# define _Mdouble_ 		long double
Packit 6c4009
# define __MATH_PRECNAME(name)	name##l
Packit 6c4009
# include <bits/cmathcalls.h>
Packit 6c4009
#endif
Packit 6c4009
#undef	_Mdouble_
Packit 6c4009
#undef	__MATH_PRECNAME
Packit 6c4009
Packit 6c4009
#if (__HAVE_DISTINCT_FLOAT16 || (__HAVE_FLOAT16 && !defined _LIBC)) \
Packit 6c4009
     && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
# define _Mdouble_complex_	__CFLOAT16
Packit 6c4009
# define _Mdouble_		_Float16
Packit 6c4009
# define __MATH_PRECNAME(name)	name##f16
Packit 6c4009
# include <bits/cmathcalls.h>
Packit 6c4009
# undef _Mdouble_
Packit 6c4009
# undef __MATH_PRECNAME
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if (__HAVE_DISTINCT_FLOAT32 || (__HAVE_FLOAT32 && !defined _LIBC)) \
Packit 6c4009
     && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
# define _Mdouble_complex_	__CFLOAT32
Packit 6c4009
# define _Mdouble_		_Float32
Packit 6c4009
# define __MATH_PRECNAME(name)	name##f32
Packit 6c4009
# include <bits/cmathcalls.h>
Packit 6c4009
# undef _Mdouble_
Packit 6c4009
# undef __MATH_PRECNAME
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if (__HAVE_DISTINCT_FLOAT64 || (__HAVE_FLOAT64 && !defined _LIBC)) \
Packit 6c4009
     && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
# define _Mdouble_complex_	__CFLOAT64
Packit 6c4009
# define _Mdouble_		_Float64
Packit 6c4009
# define __MATH_PRECNAME(name)	name##f64
Packit 6c4009
# include <bits/cmathcalls.h>
Packit 6c4009
# undef _Mdouble_
Packit 6c4009
# undef __MATH_PRECNAME
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if (__HAVE_DISTINCT_FLOAT128 || (__HAVE_FLOAT128 && !defined _LIBC)) \
Packit 6c4009
     && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
# define _Mdouble_complex_	__CFLOAT128
Packit 6c4009
# define _Mdouble_		_Float128
Packit 6c4009
# define __MATH_PRECNAME(name)	name##f128
Packit 6c4009
# include <bits/cmathcalls.h>
Packit 6c4009
# undef _Mdouble_
Packit 6c4009
# undef __MATH_PRECNAME
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if (__HAVE_DISTINCT_FLOAT32X || (__HAVE_FLOAT32X && !defined _LIBC)) \
Packit 6c4009
     && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
# define _Mdouble_complex_	__CFLOAT32X
Packit 6c4009
# define _Mdouble_		_Float32x
Packit 6c4009
# define __MATH_PRECNAME(name)	name##f32x
Packit 6c4009
# include <bits/cmathcalls.h>
Packit 6c4009
# undef _Mdouble_
Packit 6c4009
# undef __MATH_PRECNAME
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if (__HAVE_DISTINCT_FLOAT64X || (__HAVE_FLOAT64X && !defined _LIBC)) \
Packit 6c4009
     && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
# define _Mdouble_complex_	__CFLOAT64X
Packit 6c4009
# define _Mdouble_		_Float64x
Packit 6c4009
# define __MATH_PRECNAME(name)	name##f64x
Packit 6c4009
# include <bits/cmathcalls.h>
Packit 6c4009
# undef _Mdouble_
Packit 6c4009
# undef __MATH_PRECNAME
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if (__HAVE_DISTINCT_FLOAT128X || (__HAVE_FLOAT128X && !defined _LIBC)) \
Packit 6c4009
     && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
# define _Mdouble_complex_	__CFLOAT128X
Packit 6c4009
# define _Mdouble_		_Float128x
Packit 6c4009
# define __MATH_PRECNAME(name)	name##f128x
Packit 6c4009
# include <bits/cmathcalls.h>
Packit 6c4009
# undef _Mdouble_
Packit 6c4009
# undef __MATH_PRECNAME
Packit 6c4009
# undef _Mdouble_complex_
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#undef	__MATHDECL_1
Packit 6c4009
#undef	__MATHDECL
Packit 6c4009
#undef	__MATHCALL
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* complex.h */