Blame math/tgmath.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 Standard: 7.22 Type-generic math	<tgmath.h>
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef _TGMATH_H
Packit 6c4009
#define _TGMATH_H	1
Packit 6c4009
Packit 6c4009
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
Packit 6c4009
#include <bits/libc-header-start.h>
Packit 6c4009
Packit 6c4009
/* Include the needed headers.  */
Packit 6c4009
#include <bits/floatn.h>
Packit 6c4009
#include <math.h>
Packit 6c4009
#include <complex.h>
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* There are two variant implementations of type-generic macros in
Packit 6c4009
   this file: one for GCC 8 and later, using __builtin_tgmath and
Packit 6c4009
   where each macro expands each of its arguments only once, and one
Packit 6c4009
   for older GCC, using other compiler extensions but with macros
Packit 6c4009
   expanding their arguments many times (so resulting in exponential
Packit 6c4009
   blowup of the size of expansions when calls to such macros are
Packit 6c4009
   nested inside arguments to such macros).  */
Packit 6c4009
Packit 6c4009
#define __HAVE_BUILTIN_TGMATH __GNUC_PREREQ (8, 0)
Packit 6c4009
Packit 6c4009
#if __GNUC_PREREQ (2, 7)
Packit 6c4009
Packit 6c4009
# if __HAVE_BUILTIN_TGMATH
Packit 6c4009
Packit 6c4009
#  if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
#   define __TG_F16_ARG(X) X ## f16,
Packit 6c4009
#  else
Packit 6c4009
#   define __TG_F16_ARG(X)
Packit 6c4009
#  endif
Packit 6c4009
#  if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
#   define __TG_F32_ARG(X) X ## f32,
Packit 6c4009
#  else
Packit 6c4009
#   define __TG_F32_ARG(X)
Packit 6c4009
#  endif
Packit 6c4009
#  if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
#   define __TG_F64_ARG(X) X ## f64,
Packit 6c4009
#  else
Packit 6c4009
#   define __TG_F64_ARG(X)
Packit 6c4009
#  endif
Packit 6c4009
#  if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
#   define __TG_F128_ARG(X) X ## f128,
Packit 6c4009
#  else
Packit 6c4009
#   define __TG_F128_ARG(X)
Packit 6c4009
#  endif
Packit 6c4009
#  if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
#   define __TG_F32X_ARG(X) X ## f32x,
Packit 6c4009
#  else
Packit 6c4009
#   define __TG_F32X_ARG(X)
Packit 6c4009
#  endif
Packit 6c4009
#  if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
#   define __TG_F64X_ARG(X) X ## f64x,
Packit 6c4009
#  else
Packit 6c4009
#   define __TG_F64X_ARG(X)
Packit 6c4009
#  endif
Packit 6c4009
#  if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
#   define __TG_F128X_ARG(X) X ## f128x,
Packit 6c4009
#  else
Packit 6c4009
#   define __TG_F128X_ARG(X)
Packit 6c4009
#  endif
Packit 6c4009
Packit 6c4009
#  define __TGMATH_FUNCS(X) X ## f, X, X ## l,				\
Packit 6c4009
    __TG_F16_ARG (X) __TG_F32_ARG (X) __TG_F64_ARG (X) __TG_F128_ARG (X) \
Packit 6c4009
    __TG_F32X_ARG (X) __TG_F64X_ARG (X) __TG_F128X_ARG (X)
Packit 6c4009
#  define __TGMATH_RCFUNCS(F, C) __TGMATH_FUNCS (F) __TGMATH_FUNCS (C)
Packit 6c4009
#  define __TGMATH_1(F, X) __builtin_tgmath (__TGMATH_FUNCS (F) (X))
Packit 6c4009
#  define __TGMATH_2(F, X, Y) __builtin_tgmath (__TGMATH_FUNCS (F) (X), (Y))
Packit 6c4009
#  define __TGMATH_2STD(F, X, Y) __builtin_tgmath (F ## f, F, F ## l, (X), (Y))
Packit 6c4009
#  define __TGMATH_3(F, X, Y, Z) __builtin_tgmath (__TGMATH_FUNCS (F)	\
Packit 6c4009
						   (X), (Y), (Z))
Packit 6c4009
#  define __TGMATH_1C(F, C, X) __builtin_tgmath (__TGMATH_RCFUNCS (F, C) (X))
Packit 6c4009
#  define __TGMATH_2C(F, C, X, Y) __builtin_tgmath (__TGMATH_RCFUNCS (F, C) \
Packit 6c4009
						    (X), (Y))
Packit 6c4009
Packit 6c4009
# else /* !__HAVE_BUILTIN_TGMATH.  */
Packit 6c4009
Packit 6c4009
#  ifdef __NO_LONG_DOUBLE_MATH
Packit 6c4009
#   define __tgml(fct) fct
Packit 6c4009
#  else
Packit 6c4009
#   define __tgml(fct) fct ## l
Packit 6c4009
#  endif
Packit 6c4009
Packit 6c4009
/* __floating_type expands to 1 if TYPE is a floating type (including
Packit 6c4009
   complex floating types), 0 if TYPE is an integer type (including
Packit 6c4009
   complex integer types).  __real_integer_type expands to 1 if TYPE
Packit 6c4009
   is a real integer type.  __complex_integer_type expands to 1 if
Packit 6c4009
   TYPE is a complex integer type.  All these macros expand to integer
Packit 6c4009
   constant expressions.  All these macros can assume their argument
Packit 6c4009
   has an arithmetic type (not vector, decimal floating-point or
Packit 6c4009
   fixed-point), valid to pass to tgmath.h macros.  */
Packit 6c4009
#  if __GNUC_PREREQ (3, 1)
Packit 6c4009
/* __builtin_classify_type expands to an integer constant expression
Packit 6c4009
   in GCC 3.1 and later.  Default conversions applied to the argument
Packit 6c4009
   of __builtin_classify_type mean it always returns 1 for real
Packit 6c4009
   integer types rather than ever returning different values for
Packit 6c4009
   character, boolean or enumerated types.  */
Packit 6c4009
#   define __floating_type(type)				\
Packit 6c4009
  (__builtin_classify_type (__real__ ((type) 0)) == 8)
Packit 6c4009
#   define __real_integer_type(type)		\
Packit 6c4009
  (__builtin_classify_type ((type) 0) == 1)
Packit 6c4009
#   define __complex_integer_type(type)				\
Packit 6c4009
  (__builtin_classify_type ((type) 0) == 9			\
Packit 6c4009
   && __builtin_classify_type (__real__ ((type) 0)) == 1)
Packit 6c4009
#  else
Packit 6c4009
/* GCC versions predating __builtin_classify_type are also looser on
Packit 6c4009
   what counts as an integer constant expression.  */
Packit 6c4009
#   define __floating_type(type) (((type) 1.25) != 1)
Packit 6c4009
#   define __real_integer_type(type) (((type) (1.25 + _Complex_I)) == 1)
Packit 6c4009
#   define __complex_integer_type(type)			\
Packit 6c4009
  (((type) (1.25 + _Complex_I)) == (1 + _Complex_I))
Packit 6c4009
#  endif
Packit 6c4009
Packit 6c4009
/* Whether an expression (of arithmetic type) has a real type.  */
Packit 6c4009
#  define __expr_is_real(E) (__builtin_classify_type (E) != 9)
Packit 6c4009
Packit 6c4009
/* The tgmath real type for T, where E is 0 if T is an integer type
Packit 6c4009
   and 1 for a floating type.  If T has a complex type, it is
Packit 6c4009
   unspecified whether the return type is real or complex (but it has
Packit 6c4009
   the correct corresponding real type).  */
Packit 6c4009
#  define __tgmath_real_type_sub(T, E) \
Packit 6c4009
  __typeof__ (*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0	      \
Packit 6c4009
		  : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0))
Packit 6c4009
Packit 6c4009
/* The tgmath real type of EXPR.  */
Packit 6c4009
#  define __tgmath_real_type(expr) \
Packit 6c4009
  __tgmath_real_type_sub (__typeof__ ((__typeof__ (+(expr))) 0),	      \
Packit 6c4009
			  __floating_type (__typeof__ (+(expr))))
Packit 6c4009
Packit 6c4009
/* The tgmath complex type for T, where E1 is 1 if T has a floating
Packit 6c4009
   type and 0 otherwise, E2 is 1 if T has a real integer type and 0
Packit 6c4009
   otherwise, and E3 is 1 if T has a complex type and 0 otherwise.  */
Packit 6c4009
#  define __tgmath_complex_type_sub(T, E1, E2, E3)			\
Packit 6c4009
  __typeof__ (*(0							\
Packit 6c4009
		? (__typeof__ (0 ? (T *) 0 : (void *) (!(E1)))) 0	\
Packit 6c4009
		: (__typeof__ (0					\
Packit 6c4009
			       ? (__typeof__ (0				\
Packit 6c4009
					      ? (double *) 0		\
Packit 6c4009
					      : (void *) (!(E2)))) 0	\
Packit 6c4009
			       : (__typeof__ (0				\
Packit 6c4009
					      ? (_Complex double *) 0	\
Packit 6c4009
					      : (void *) (!(E3)))) 0)) 0))
Packit 6c4009
Packit 6c4009
/* The tgmath complex type of EXPR.  */
Packit 6c4009
#  define __tgmath_complex_type(expr)					\
Packit 6c4009
  __tgmath_complex_type_sub (__typeof__ ((__typeof__ (+(expr))) 0),	\
Packit 6c4009
			     __floating_type (__typeof__ (+(expr))),	\
Packit 6c4009
			     __real_integer_type (__typeof__ (+(expr))), \
Packit 6c4009
			     __complex_integer_type (__typeof__ (+(expr))))
Packit 6c4009
Packit 6c4009
#  if (__HAVE_DISTINCT_FLOAT16			\
Packit 6c4009
      || __HAVE_DISTINCT_FLOAT32		\
Packit 6c4009
      || __HAVE_DISTINCT_FLOAT64		\
Packit 6c4009
      || __HAVE_DISTINCT_FLOAT32X		\
Packit 6c4009
      || __HAVE_DISTINCT_FLOAT64X		\
Packit 6c4009
      || __HAVE_DISTINCT_FLOAT128X)
Packit 6c4009
#   error "Unsupported _FloatN or _FloatNx types for <tgmath.h>."
Packit 6c4009
#  endif
Packit 6c4009
Packit 6c4009
/* Expand to text that checks if ARG_COMB has type _Float128, and if
Packit 6c4009
   so calls the appropriately suffixed FCT (which may include a cast),
Packit 6c4009
   or FCT and CFCT for complex functions, with arguments ARG_CALL.  */
Packit 6c4009
#  if __HAVE_DISTINCT_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
#   if (!__HAVE_FLOAT64X			\
Packit 6c4009
       || __HAVE_FLOAT64X_LONG_DOUBLE		\
Packit 6c4009
       || !__HAVE_FLOATN_NOT_TYPEDEF)
Packit 6c4009
#    define __TGMATH_F128(arg_comb, fct, arg_call)			\
Packit 6c4009
  __builtin_types_compatible_p (__typeof (+(arg_comb)), _Float128)	\
Packit 6c4009
  ? fct ## f128 arg_call :
Packit 6c4009
#    define __TGMATH_CF128(arg_comb, fct, cfct, arg_call)		\
Packit 6c4009
  __builtin_types_compatible_p (__typeof (+__real__ (arg_comb)), _Float128) \
Packit 6c4009
  ? (__expr_is_real (arg_comb)						\
Packit 6c4009
     ? fct ## f128 arg_call						\
Packit 6c4009
     : cfct ## f128 arg_call) :
Packit 6c4009
#   else
Packit 6c4009
/* _Float64x is a distinct type at the C language level, which must be
Packit 6c4009
   handled like _Float128.  */
Packit 6c4009
#    define __TGMATH_F128(arg_comb, fct, arg_call)			\
Packit 6c4009
  (__builtin_types_compatible_p (__typeof (+(arg_comb)), _Float128)	\
Packit 6c4009
   || __builtin_types_compatible_p (__typeof (+(arg_comb)), _Float64x)) \
Packit 6c4009
  ? fct ## f128 arg_call :
Packit 6c4009
#    define __TGMATH_CF128(arg_comb, fct, cfct, arg_call)		\
Packit 6c4009
  (__builtin_types_compatible_p (__typeof (+__real__ (arg_comb)), _Float128) \
Packit 6c4009
   || __builtin_types_compatible_p (__typeof (+__real__ (arg_comb)),	\
Packit 6c4009
				    _Float64x))				\
Packit 6c4009
  ? (__expr_is_real (arg_comb)						\
Packit 6c4009
     ? fct ## f128 arg_call						\
Packit 6c4009
     : cfct ## f128 arg_call) :
Packit 6c4009
#   endif
Packit 6c4009
#  else
Packit 6c4009
#   define __TGMATH_F128(arg_comb, fct, arg_call) /* Nothing.  */
Packit 6c4009
#   define __TGMATH_CF128(arg_comb, fct, cfct, arg_call) /* Nothing.  */
Packit 6c4009
#  endif
Packit 6c4009
Packit 6c4009
# endif /* !__HAVE_BUILTIN_TGMATH.  */
Packit 6c4009
Packit 6c4009
/* We have two kinds of generic macros: to support functions which are
Packit 6c4009
   only defined on real valued parameters and those which are defined
Packit 6c4009
   for complex functions as well.  */
Packit 6c4009
# if __HAVE_BUILTIN_TGMATH
Packit 6c4009
Packit 6c4009
#  define __TGMATH_UNARY_REAL_ONLY(Val, Fct) __TGMATH_1 (Fct, (Val))
Packit 6c4009
#  define __TGMATH_UNARY_REAL_RET_ONLY(Val, Fct) __TGMATH_1 (Fct, (Val))
Packit 6c4009
#  define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct)	\
Packit 6c4009
  __TGMATH_2 (Fct, (Val1), (Val2))
Packit 6c4009
#  define __TGMATH_BINARY_FIRST_REAL_STD_ONLY(Val1, Val2, Fct)	\
Packit 6c4009
  __TGMATH_2STD (Fct, (Val1), (Val2))
Packit 6c4009
#  define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct)	\
Packit 6c4009
  __TGMATH_2 (Fct, (Val1), (Val2))
Packit 6c4009
#  define __TGMATH_BINARY_REAL_STD_ONLY(Val1, Val2, Fct)	\
Packit 6c4009
  __TGMATH_2STD (Fct, (Val1), (Val2))
Packit 6c4009
#  define __TGMATH_BINARY_REAL_RET_ONLY(Val1, Val2, Fct)	\
Packit 6c4009
  __TGMATH_2 (Fct, (Val1), (Val2))
Packit 6c4009
#  define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
Packit 6c4009
  __TGMATH_3 (Fct, (Val1), (Val2), (Val3))
Packit 6c4009
#  define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct)	\
Packit 6c4009
  __TGMATH_3 (Fct, (Val1), (Val2), (Val3))
Packit 6c4009
#  define __TGMATH_TERNARY_FIRST_REAL_RET_ONLY(Val1, Val2, Val3, Fct)	\
Packit 6c4009
  __TGMATH_3 (Fct, (Val1), (Val2), (Val3))
Packit 6c4009
#  define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct)	\
Packit 6c4009
  __TGMATH_1C (Fct, Cfct, (Val))
Packit 6c4009
#  define __TGMATH_UNARY_IMAG(Val, Cfct) __TGMATH_1 (Cfct, (Val))
Packit 6c4009
#  define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct)	\
Packit 6c4009
  __TGMATH_1C (Fct, Cfct, (Val))
Packit 6c4009
#  define __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME(Val, Cfct)	\
Packit 6c4009
  __TGMATH_1 (Cfct, (Val))
Packit 6c4009
#  define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct)	\
Packit 6c4009
  __TGMATH_2C (Fct, Cfct, (Val1), (Val2))
Packit 6c4009
Packit 6c4009
# else /* !__HAVE_BUILTIN_TGMATH.  */
Packit 6c4009
Packit 6c4009
#  define __TGMATH_UNARY_REAL_ONLY(Val, Fct)				\
Packit 6c4009
  (__extension__ ((sizeof (+(Val)) == sizeof (double)			      \
Packit 6c4009
		      || __builtin_classify_type (Val) != 8)		      \
Packit 6c4009
		     ? (__tgmath_real_type (Val)) Fct (Val)		      \
Packit 6c4009
		     : (sizeof (+(Val)) == sizeof (float))		      \
Packit 6c4009
		     ? (__tgmath_real_type (Val)) Fct##f (Val)		      \
Packit 6c4009
		     : __TGMATH_F128 ((Val), (__tgmath_real_type (Val)) Fct,  \
Packit 6c4009
				      (Val))				      \
Packit 6c4009
		     (__tgmath_real_type (Val)) __tgml(Fct) (Val)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_UNARY_REAL_RET_ONLY(Val, Fct) \
Packit 6c4009
     (__extension__ ((sizeof (+(Val)) == sizeof (double)		      \
Packit 6c4009
		      || __builtin_classify_type (Val) != 8)		      \
Packit 6c4009
		     ? Fct (Val)					      \
Packit 6c4009
		     : (sizeof (+(Val)) == sizeof (float))		      \
Packit 6c4009
		     ? Fct##f (Val)					      \
Packit 6c4009
		     : __TGMATH_F128 ((Val), Fct, (Val))		      \
Packit 6c4009
		     __tgml(Fct) (Val)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
Packit 6c4009
     (__extension__ ((sizeof (+(Val1)) == sizeof (double)		      \
Packit 6c4009
		      || __builtin_classify_type (Val1) != 8)		      \
Packit 6c4009
		     ? (__tgmath_real_type (Val1)) Fct (Val1, Val2)	      \
Packit 6c4009
		     : (sizeof (+(Val1)) == sizeof (float))		      \
Packit 6c4009
		     ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2)	      \
Packit 6c4009
		     : __TGMATH_F128 ((Val1), (__tgmath_real_type (Val1)) Fct, \
Packit 6c4009
				    (Val1, Val2))			      \
Packit 6c4009
		     (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_BINARY_FIRST_REAL_STD_ONLY(Val1, Val2, Fct) \
Packit 6c4009
     (__extension__ ((sizeof (+(Val1)) == sizeof (double)		      \
Packit 6c4009
		      || __builtin_classify_type (Val1) != 8)		      \
Packit 6c4009
		     ? (__tgmath_real_type (Val1)) Fct (Val1, Val2)	      \
Packit 6c4009
		     : (sizeof (+(Val1)) == sizeof (float))		      \
Packit 6c4009
		     ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2)	      \
Packit 6c4009
		     : (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
Packit 6c4009
     (__extension__ ((sizeof ((Val1) + (Val2)) > sizeof (double)	      \
Packit 6c4009
		      && __builtin_classify_type ((Val1) + (Val2)) == 8)      \
Packit 6c4009
		     ? __TGMATH_F128 ((Val1) + (Val2),			      \
Packit 6c4009
				      (__typeof				      \
Packit 6c4009
				       ((__tgmath_real_type (Val1)) 0	      \
Packit 6c4009
					+ (__tgmath_real_type (Val2)) 0)) Fct, \
Packit 6c4009
				      (Val1, Val2))			      \
Packit 6c4009
		     (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				+ (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		     __tgml(Fct) (Val1, Val2)				      \
Packit 6c4009
		     : (sizeof (+(Val1)) == sizeof (double)		      \
Packit 6c4009
			|| sizeof (+(Val2)) == sizeof (double)		      \
Packit 6c4009
			|| __builtin_classify_type (Val1) != 8		      \
Packit 6c4009
			|| __builtin_classify_type (Val2) != 8)		      \
Packit 6c4009
		     ? (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				   + (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		       Fct (Val1, Val2)					      \
Packit 6c4009
		     : (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				   + (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		       Fct##f (Val1, Val2)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_BINARY_REAL_STD_ONLY(Val1, Val2, Fct) \
Packit 6c4009
     (__extension__ ((sizeof ((Val1) + (Val2)) > sizeof (double)	      \
Packit 6c4009
		      && __builtin_classify_type ((Val1) + (Val2)) == 8)      \
Packit 6c4009
		     ? (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				  + (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		       __tgml(Fct) (Val1, Val2)				      \
Packit 6c4009
		     : (sizeof (+(Val1)) == sizeof (double)		      \
Packit 6c4009
			|| sizeof (+(Val2)) == sizeof (double)		      \
Packit 6c4009
			|| __builtin_classify_type (Val1) != 8		      \
Packit 6c4009
			|| __builtin_classify_type (Val2) != 8)		      \
Packit 6c4009
		     ? (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				   + (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		       Fct (Val1, Val2)					      \
Packit 6c4009
		     : (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				   + (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		       Fct##f (Val1, Val2)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_BINARY_REAL_RET_ONLY(Val1, Val2, Fct) \
Packit 6c4009
     (__extension__ ((sizeof ((Val1) + (Val2)) > sizeof (double)	      \
Packit 6c4009
		      && __builtin_classify_type ((Val1) + (Val2)) == 8)      \
Packit 6c4009
		     ? __TGMATH_F128 ((Val1) + (Val2), Fct, (Val1, Val2))     \
Packit 6c4009
		     __tgml(Fct) (Val1, Val2)				      \
Packit 6c4009
		     : (sizeof (+(Val1)) == sizeof (double)		      \
Packit 6c4009
			|| sizeof (+(Val2)) == sizeof (double)		      \
Packit 6c4009
			|| __builtin_classify_type (Val1) != 8		      \
Packit 6c4009
			|| __builtin_classify_type (Val2) != 8)		      \
Packit 6c4009
		     ? Fct (Val1, Val2)					      \
Packit 6c4009
		     : Fct##f (Val1, Val2)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
Packit 6c4009
     (__extension__ ((sizeof ((Val1) + (Val2)) > sizeof (double)	      \
Packit 6c4009
		      && __builtin_classify_type ((Val1) + (Val2)) == 8)      \
Packit 6c4009
		     ? __TGMATH_F128 ((Val1) + (Val2),			      \
Packit 6c4009
				      (__typeof				      \
Packit 6c4009
				       ((__tgmath_real_type (Val1)) 0	      \
Packit 6c4009
					+ (__tgmath_real_type (Val2)) 0)) Fct, \
Packit 6c4009
				      (Val1, Val2, Val3))		      \
Packit 6c4009
		     (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				+ (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		     __tgml(Fct) (Val1, Val2, Val3)			      \
Packit 6c4009
		     : (sizeof (+(Val1)) == sizeof (double)		      \
Packit 6c4009
			|| sizeof (+(Val2)) == sizeof (double)		      \
Packit 6c4009
			|| __builtin_classify_type (Val1) != 8		      \
Packit 6c4009
			|| __builtin_classify_type (Val2) != 8)		      \
Packit 6c4009
		     ? (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				   + (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		       Fct (Val1, Val2, Val3)				      \
Packit 6c4009
		     : (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				   + (__tgmath_real_type (Val2)) 0))	      \
Packit 6c4009
		       Fct##f (Val1, Val2, Val3)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
Packit 6c4009
     (__extension__ ((sizeof ((Val1) + (Val2) + (Val3)) > sizeof (double)     \
Packit 6c4009
		      && __builtin_classify_type ((Val1) + (Val2) + (Val3))   \
Packit 6c4009
			 == 8)						      \
Packit 6c4009
		     ? __TGMATH_F128 ((Val1) + (Val2) + (Val3),		      \
Packit 6c4009
				      (__typeof				      \
Packit 6c4009
				       ((__tgmath_real_type (Val1)) 0	      \
Packit 6c4009
					+ (__tgmath_real_type (Val2)) 0	      \
Packit 6c4009
					+ (__tgmath_real_type (Val3)) 0)) Fct, \
Packit 6c4009
				      (Val1, Val2, Val3))		      \
Packit 6c4009
		     (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				+ (__tgmath_real_type (Val2)) 0		      \
Packit 6c4009
				+ (__tgmath_real_type (Val3)) 0))	      \
Packit 6c4009
		       __tgml(Fct) (Val1, Val2, Val3)			      \
Packit 6c4009
		     : (sizeof (+(Val1)) == sizeof (double)		      \
Packit 6c4009
			|| sizeof (+(Val2)) == sizeof (double)		      \
Packit 6c4009
			|| sizeof (+(Val3)) == sizeof (double)		      \
Packit 6c4009
			|| __builtin_classify_type (Val1) != 8		      \
Packit 6c4009
			|| __builtin_classify_type (Val2) != 8		      \
Packit 6c4009
			|| __builtin_classify_type (Val3) != 8)		      \
Packit 6c4009
		     ? (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				   + (__tgmath_real_type (Val2)) 0	      \
Packit 6c4009
				   + (__tgmath_real_type (Val3)) 0))	      \
Packit 6c4009
		       Fct (Val1, Val2, Val3)				      \
Packit 6c4009
		     : (__typeof ((__tgmath_real_type (Val1)) 0		      \
Packit 6c4009
				   + (__tgmath_real_type (Val2)) 0	      \
Packit 6c4009
				   + (__tgmath_real_type (Val3)) 0))	      \
Packit 6c4009
		       Fct##f (Val1, Val2, Val3)))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_TERNARY_FIRST_REAL_RET_ONLY(Val1, Val2, Val3, Fct) \
Packit 6c4009
     (__extension__ ((sizeof (+(Val1)) == sizeof (double)		\
Packit 6c4009
		      || __builtin_classify_type (Val1) != 8)		\
Packit 6c4009
		     ? Fct (Val1, Val2, Val3)				\
Packit 6c4009
		     : (sizeof (+(Val1)) == sizeof (float))		\
Packit 6c4009
		     ? Fct##f (Val1, Val2, Val3)			\
Packit 6c4009
		     : __TGMATH_F128 ((Val1), Fct, (Val1, Val2, Val3))	\
Packit 6c4009
		     __tgml(Fct) (Val1, Val2, Val3)))
Packit 6c4009
Packit 6c4009
/* XXX This definition has to be changed as soon as the compiler understands
Packit 6c4009
   the imaginary keyword.  */
Packit 6c4009
#  define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
Packit 6c4009
     (__extension__ ((sizeof (+__real__ (Val)) == sizeof (double)	      \
Packit 6c4009
		      || __builtin_classify_type (__real__ (Val)) != 8)	      \
Packit 6c4009
		     ? (__expr_is_real (Val)				      \
Packit 6c4009
			? (__tgmath_complex_type (Val)) Fct (Val)	      \
Packit 6c4009
			: (__tgmath_complex_type (Val)) Cfct (Val))	      \
Packit 6c4009
		     : (sizeof (+__real__ (Val)) == sizeof (float))	      \
Packit 6c4009
		     ? (__expr_is_real (Val)				      \
Packit 6c4009
			? (__tgmath_complex_type (Val)) Fct##f (Val)	      \
Packit 6c4009
			: (__tgmath_complex_type (Val)) Cfct##f (Val))	      \
Packit 6c4009
		     : __TGMATH_CF128 ((Val),				      \
Packit 6c4009
				       (__tgmath_complex_type (Val)) Fct,     \
Packit 6c4009
				       (__tgmath_complex_type (Val)) Cfct,    \
Packit 6c4009
				       (Val))				      \
Packit 6c4009
		     (__expr_is_real (Val)				      \
Packit 6c4009
		      ? (__tgmath_complex_type (Val)) __tgml(Fct) (Val)	      \
Packit 6c4009
		      : (__tgmath_complex_type (Val)) __tgml(Cfct) (Val))))
Packit 6c4009
Packit 6c4009
#  define __TGMATH_UNARY_IMAG(Val, Cfct) \
Packit 6c4009
     (__extension__ ((sizeof (+__real__ (Val)) == sizeof (double)	      \
Packit 6c4009
		      || __builtin_classify_type (__real__ (Val)) != 8)	      \
Packit 6c4009
		     ? (__typeof__ ((__tgmath_real_type (Val)) 0	      \
Packit 6c4009
				    + _Complex_I)) Cfct (Val)		      \
Packit 6c4009
		     : (sizeof (+__real__ (Val)) == sizeof (float))	      \
Packit 6c4009
		     ? (__typeof__ ((__tgmath_real_type (Val)) 0	      \
Packit 6c4009
				    + _Complex_I)) Cfct##f (Val)	      \
Packit 6c4009
		     : __TGMATH_F128 (__real__ (Val),			      \
Packit 6c4009
				      (__typeof__			      \
Packit 6c4009
				       ((__tgmath_real_type (Val)) 0	      \
Packit 6c4009
					+ _Complex_I)) Cfct, (Val))	      \
Packit 6c4009
		     (__typeof__ ((__tgmath_real_type (Val)) 0		      \
Packit 6c4009
				  + _Complex_I)) __tgml(Cfct) (Val)))
Packit 6c4009
Packit 6c4009
/* XXX This definition has to be changed as soon as the compiler understands
Packit 6c4009
   the imaginary keyword.  */
Packit 6c4009
#  define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
Packit 6c4009
     (__extension__ ((sizeof (+__real__ (Val)) == sizeof (double)	      \
Packit 6c4009
		      || __builtin_classify_type (__real__ (Val)) != 8)	      \
Packit 6c4009
		     ? (__expr_is_real (Val)				      \
Packit 6c4009
			? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
Packit 6c4009
			  Fct (Val)					      \
Packit 6c4009
			: (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
Packit 6c4009
			  Cfct (Val))					      \
Packit 6c4009
		     : (sizeof (+__real__ (Val)) == sizeof (float))	      \
Packit 6c4009
		     ? (__expr_is_real (Val)				      \
Packit 6c4009
			? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
Packit 6c4009
			  Fct##f (Val)					      \
Packit 6c4009
			: (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
Packit 6c4009
			  Cfct##f (Val))				      \
Packit 6c4009
		     : __TGMATH_CF128 ((Val), \
Packit 6c4009
				       (__typeof__			      \
Packit 6c4009
					(__real__			      \
Packit 6c4009
					 (__tgmath_real_type (Val)) 0)) Fct,  \
Packit 6c4009
				       (__typeof__			      \
Packit 6c4009
					(__real__			      \
Packit 6c4009
					 (__tgmath_real_type (Val)) 0)) Cfct, \
Packit 6c4009
				       (Val))				      \
Packit 6c4009
		     (__expr_is_real (Val)				      \
Packit 6c4009
		      ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))  \
Packit 6c4009
		      __tgml(Fct) (Val)					      \
Packit 6c4009
		      : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))  \
Packit 6c4009
		      __tgml(Cfct) (Val))))
Packit 6c4009
#  define __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME(Val, Cfct)	\
Packit 6c4009
  __TGMATH_UNARY_REAL_IMAG_RET_REAL ((Val), Cfct, Cfct)
Packit 6c4009
Packit 6c4009
/* XXX This definition has to be changed as soon as the compiler understands
Packit 6c4009
   the imaginary keyword.  */
Packit 6c4009
#  define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
Packit 6c4009
     (__extension__ ((sizeof (__real__ (Val1)				      \
Packit 6c4009
			      + __real__ (Val2)) > sizeof (double)	      \
Packit 6c4009
		      && __builtin_classify_type (__real__ (Val1)	      \
Packit 6c4009
						  + __real__ (Val2)) == 8)    \
Packit 6c4009
		     ? __TGMATH_CF128 ((Val1) + (Val2),			      \
Packit 6c4009
				       (__typeof			      \
Packit 6c4009
					((__tgmath_complex_type (Val1)) 0     \
Packit 6c4009
					 + (__tgmath_complex_type (Val2)) 0)) \
Packit 6c4009
				       Fct,				      \
Packit 6c4009
				       (__typeof			      \
Packit 6c4009
					((__tgmath_complex_type (Val1)) 0     \
Packit 6c4009
					 + (__tgmath_complex_type (Val2)) 0)) \
Packit 6c4009
				       Cfct,				      \
Packit 6c4009
				       (Val1, Val2))			      \
Packit 6c4009
		     (__expr_is_real ((Val1) + (Val2))			      \
Packit 6c4009
		      ? (__typeof ((__tgmath_complex_type (Val1)) 0	      \
Packit 6c4009
				   + (__tgmath_complex_type (Val2)) 0))	      \
Packit 6c4009
		      __tgml(Fct) (Val1, Val2)				      \
Packit 6c4009
		      : (__typeof ((__tgmath_complex_type (Val1)) 0	      \
Packit 6c4009
				   + (__tgmath_complex_type (Val2)) 0))	      \
Packit 6c4009
		      __tgml(Cfct) (Val1, Val2))			      \
Packit 6c4009
		     : (sizeof (+__real__ (Val1)) == sizeof (double)	      \
Packit 6c4009
			|| sizeof (+__real__ (Val2)) == sizeof (double)	      \
Packit 6c4009
			|| __builtin_classify_type (__real__ (Val1)) != 8     \
Packit 6c4009
			|| __builtin_classify_type (__real__ (Val2)) != 8)    \
Packit 6c4009
		     ? (__expr_is_real ((Val1) + (Val2))		      \
Packit 6c4009
			? (__typeof ((__tgmath_complex_type (Val1)) 0	      \
Packit 6c4009
				   + (__tgmath_complex_type (Val2)) 0))	      \
Packit 6c4009
			  Fct (Val1, Val2)				      \
Packit 6c4009
			: (__typeof ((__tgmath_complex_type (Val1)) 0	      \
Packit 6c4009
				   + (__tgmath_complex_type (Val2)) 0))	      \
Packit 6c4009
			  Cfct (Val1, Val2))				      \
Packit 6c4009
		     : (__expr_is_real ((Val1) + (Val2))		      \
Packit 6c4009
			? (__typeof ((__tgmath_complex_type (Val1)) 0	      \
Packit 6c4009
				   + (__tgmath_complex_type (Val2)) 0))	      \
Packit 6c4009
			  Fct##f (Val1, Val2)				      \
Packit 6c4009
			: (__typeof ((__tgmath_complex_type (Val1)) 0	      \
Packit 6c4009
				   + (__tgmath_complex_type (Val2)) 0))	      \
Packit 6c4009
			  Cfct##f (Val1, Val2))))
Packit 6c4009
# endif /* !__HAVE_BUILTIN_TGMATH.  */
Packit 6c4009
#else
Packit 6c4009
# error "Unsupported compiler; you cannot use <tgmath.h>"
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Unary functions defined for real and complex values.  */
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Trigonometric functions.  */
Packit 6c4009
Packit 6c4009
/* Arc cosine of X.  */
Packit 6c4009
#define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos)
Packit 6c4009
/* Arc sine of X.  */
Packit 6c4009
#define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin)
Packit 6c4009
/* Arc tangent of X.  */
Packit 6c4009
#define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan)
Packit 6c4009
/* Arc tangent of Y/X.  */
Packit 6c4009
#define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2)
Packit 6c4009
Packit 6c4009
/* Cosine of X.  */
Packit 6c4009
#define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos)
Packit 6c4009
/* Sine of X.  */
Packit 6c4009
#define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin)
Packit 6c4009
/* Tangent of X.  */
Packit 6c4009
#define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Hyperbolic functions.  */
Packit 6c4009
Packit 6c4009
/* Hyperbolic arc cosine of X.  */
Packit 6c4009
#define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh)
Packit 6c4009
/* Hyperbolic arc sine of X.  */
Packit 6c4009
#define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh)
Packit 6c4009
/* Hyperbolic arc tangent of X.  */
Packit 6c4009
#define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh)
Packit 6c4009
Packit 6c4009
/* Hyperbolic cosine of X.  */
Packit 6c4009
#define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh)
Packit 6c4009
/* Hyperbolic sine of X.  */
Packit 6c4009
#define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh)
Packit 6c4009
/* Hyperbolic tangent of X.  */
Packit 6c4009
#define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Exponential and logarithmic functions.  */
Packit 6c4009
Packit 6c4009
/* Exponential function of X.  */
Packit 6c4009
#define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp)
Packit 6c4009
Packit 6c4009
/* Break VALUE into a normalized fraction and an integral power of 2.  */
Packit 6c4009
#define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp)
Packit 6c4009
Packit 6c4009
/* X times (two to the EXP power).  */
Packit 6c4009
#define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp)
Packit 6c4009
Packit 6c4009
/* Natural logarithm of X.  */
Packit 6c4009
#define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog)
Packit 6c4009
Packit 6c4009
/* Base-ten logarithm of X.  */
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
# define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, clog10)
Packit 6c4009
#else
Packit 6c4009
# define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Return exp(X) - 1.  */
Packit 6c4009
#define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)
Packit 6c4009
Packit 6c4009
/* Return log(1 + X).  */
Packit 6c4009
#define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p)
Packit 6c4009
Packit 6c4009
/* Return the base 2 signed integral exponent of X.  */
Packit 6c4009
#define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb)
Packit 6c4009
Packit 6c4009
/* Compute base-2 exponential of X.  */
Packit 6c4009
#define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2)
Packit 6c4009
Packit 6c4009
/* Compute base-2 logarithm of X.  */
Packit 6c4009
#define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Power functions.  */
Packit 6c4009
Packit 6c4009
/* Return X to the Y power.  */
Packit 6c4009
#define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)
Packit 6c4009
Packit 6c4009
/* Return the square root of X.  */
Packit 6c4009
#define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)
Packit 6c4009
Packit 6c4009
/* Return `sqrt(X*X + Y*Y)'.  */
Packit 6c4009
#define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)
Packit 6c4009
Packit 6c4009
/* Return the cube root of X.  */
Packit 6c4009
#define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Nearest integer, absolute value, and remainder functions.  */
Packit 6c4009
Packit 6c4009
/* Smallest integral value not less than X.  */
Packit 6c4009
#define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
Packit 6c4009
Packit 6c4009
/* Absolute value of X.  */
Packit 6c4009
#define fabs(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, fabs, cabs)
Packit 6c4009
Packit 6c4009
/* Largest integer not greater than X.  */
Packit 6c4009
#define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
Packit 6c4009
Packit 6c4009
/* Floating-point modulo remainder of X/Y.  */
Packit 6c4009
#define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod)
Packit 6c4009
Packit 6c4009
/* Round X to integral valuein floating-point format using current
Packit 6c4009
   rounding direction, but do not raise inexact exception.  */
Packit 6c4009
#define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint)
Packit 6c4009
Packit 6c4009
/* Round X to nearest integral value, rounding halfway cases away from
Packit 6c4009
   zero.  */
Packit 6c4009
#define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round)
Packit 6c4009
Packit 6c4009
/* Round X to the integral value in floating-point format nearest but
Packit 6c4009
   not larger in magnitude.  */
Packit 6c4009
#define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc)
Packit 6c4009
Packit 6c4009
/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
Packit 6c4009
   and magnitude congruent `mod 2^n' to the magnitude of the integral
Packit 6c4009
   quotient x/y, with n >= 3.  */
Packit 6c4009
#define remquo(Val1, Val2, Val3) \
Packit 6c4009
     __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo)
Packit 6c4009
Packit 6c4009
/* Round X to nearest integral value according to current rounding
Packit 6c4009
   direction.  */
Packit 6c4009
#define lrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, lrint)
Packit 6c4009
#define llrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, llrint)
Packit 6c4009
Packit 6c4009
/* Round X to nearest integral value, rounding halfway cases away from
Packit 6c4009
   zero.  */
Packit 6c4009
#define lround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, lround)
Packit 6c4009
#define llround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, llround)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Return X with its signed changed to Y's.  */
Packit 6c4009
#define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign)
Packit 6c4009
Packit 6c4009
/* Error and gamma functions.  */
Packit 6c4009
#define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf)
Packit 6c4009
#define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc)
Packit 6c4009
#define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma)
Packit 6c4009
#define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Return the integer nearest X in the direction of the
Packit 6c4009
   prevailing rounding mode.  */
Packit 6c4009
#define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
Packit 6c4009
Packit 6c4009
#if __GLIBC_USE (IEC_60559_BFP_EXT)
Packit 6c4009
/* Return X - epsilon.  */
Packit 6c4009
# define nextdown(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextdown)
Packit 6c4009
/* Return X + epsilon.  */
Packit 6c4009
# define nextup(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextup)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
Packit 6c4009
#define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
Packit 6c4009
#define nexttoward(Val1, Val2) \
Packit 6c4009
     __TGMATH_BINARY_FIRST_REAL_STD_ONLY (Val1, Val2, nexttoward)
Packit 6c4009
Packit 6c4009
/* Return the remainder of integer divison X / Y with infinite precision.  */
Packit 6c4009
#define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
Packit 6c4009
Packit 6c4009
/* Return X times (2 to the Nth power).  */
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
# define scalb(Val1, Val2) __TGMATH_BINARY_REAL_STD_ONLY (Val1, Val2, scalb)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Return X times (2 to the Nth power).  */
Packit 6c4009
#define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn)
Packit 6c4009
Packit 6c4009
/* Return X times (2 to the Nth power).  */
Packit 6c4009
#define scalbln(Val1, Val2) \
Packit 6c4009
     __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
Packit 6c4009
Packit 6c4009
/* Return the binary exponent of X, which must be nonzero.  */
Packit 6c4009
#define ilogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, ilogb)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Return positive difference between X and Y.  */
Packit 6c4009
#define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim)
Packit 6c4009
Packit 6c4009
/* Return maximum numeric value from X and Y.  */
Packit 6c4009
#define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
Packit 6c4009
Packit 6c4009
/* Return minimum numeric value from X and Y.  */
Packit 6c4009
#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Multiply-add function computed as a ternary operation.  */
Packit 6c4009
#define fma(Val1, Val2, Val3) \
Packit 6c4009
     __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma)
Packit 6c4009
Packit 6c4009
#if __GLIBC_USE (IEC_60559_BFP_EXT)
Packit 6c4009
/* Round X to nearest integer value, rounding halfway cases to even.  */
Packit 6c4009
# define roundeven(Val) __TGMATH_UNARY_REAL_ONLY (Val, roundeven)
Packit 6c4009
Packit 6c4009
# define fromfp(Val1, Val2, Val3)					\
Packit 6c4009
  __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, fromfp)
Packit 6c4009
Packit 6c4009
# define ufromfp(Val1, Val2, Val3)					\
Packit 6c4009
  __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, ufromfp)
Packit 6c4009
Packit 6c4009
# define fromfpx(Val1, Val2, Val3)					\
Packit 6c4009
  __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, fromfpx)
Packit 6c4009
Packit 6c4009
# define ufromfpx(Val1, Val2, Val3)					\
Packit 6c4009
  __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, ufromfpx)
Packit 6c4009
Packit 6c4009
/* Like ilogb, but returning long int.  */
Packit 6c4009
# define llogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, llogb)
Packit 6c4009
Packit 6c4009
/* Return value with maximum magnitude.  */
Packit 6c4009
# define fmaxmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaxmag)
Packit 6c4009
Packit 6c4009
/* Return value with minimum magnitude.  */
Packit 6c4009
# define fminmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminmag)
Packit 6c4009
Packit 6c4009
/* Total order operation.  */
Packit 6c4009
# define totalorder(Val1, Val2)					\
Packit 6c4009
  __TGMATH_BINARY_REAL_RET_ONLY (Val1, Val2, totalorder)
Packit 6c4009
Packit 6c4009
/* Total order operation on absolute values.  */
Packit 6c4009
# define totalordermag(Val1, Val2)				\
Packit 6c4009
  __TGMATH_BINARY_REAL_RET_ONLY (Val1, Val2, totalordermag)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Absolute value, conjugates, and projection.  */
Packit 6c4009
Packit 6c4009
/* Argument value of Z.  */
Packit 6c4009
#define carg(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME (Val, carg)
Packit 6c4009
Packit 6c4009
/* Complex conjugate of Z.  */
Packit 6c4009
#define conj(Val) __TGMATH_UNARY_IMAG (Val, conj)
Packit 6c4009
Packit 6c4009
/* Projection of Z onto the Riemann sphere.  */
Packit 6c4009
#define cproj(Val) __TGMATH_UNARY_IMAG (Val, cproj)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Decomposing complex values.  */
Packit 6c4009
Packit 6c4009
/* Imaginary part of Z.  */
Packit 6c4009
#define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME (Val, cimag)
Packit 6c4009
Packit 6c4009
/* Real part of Z.  */
Packit 6c4009
#define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL_SAME (Val, creal)
Packit 6c4009
Packit 6c4009
#endif /* tgmath.h */