/*===---- tgmath.h - Standard header for type generic math ----------------===*\
*
* Copyright (c) 2009 Howard Hinnant
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
\*===----------------------------------------------------------------------===*/
#ifndef __TGMATH_H
#define __TGMATH_H
/* C99 7.22 Type-generic math <tgmath.h>. */
#include <math.h>
/* C++ handles type genericity with overloading in math.h. */
#ifndef __cplusplus
#include <complex.h>
#define _TG_ATTRSp __attribute__((__overloadable__))
#define _TG_ATTRS __attribute__((__overloadable__, __always_inline__))
// promotion
typedef void _Argument_type_is_not_arithmetic;
static _Argument_type_is_not_arithmetic __tg_promote(...)
__attribute__((__unavailable__,__overloadable__));
static double _TG_ATTRSp __tg_promote(int);
static double _TG_ATTRSp __tg_promote(unsigned int);
static double _TG_ATTRSp __tg_promote(long);
static double _TG_ATTRSp __tg_promote(unsigned long);
static double _TG_ATTRSp __tg_promote(long long);
static double _TG_ATTRSp __tg_promote(unsigned long long);
static float _TG_ATTRSp __tg_promote(float);
static double _TG_ATTRSp __tg_promote(double);
static long double _TG_ATTRSp __tg_promote(long double);
static float _Complex _TG_ATTRSp __tg_promote(float _Complex);
static double _Complex _TG_ATTRSp __tg_promote(double _Complex);
static long double _Complex _TG_ATTRSp __tg_promote(long double _Complex);
#define __tg_promote1(__x) (__typeof__(__tg_promote(__x)))
#define __tg_promote2(__x, __y) (__typeof__(__tg_promote(__x) + \
__tg_promote(__y)))
#define __tg_promote3(__x, __y, __z) (__typeof__(__tg_promote(__x) + \
__tg_promote(__y) + \
__tg_promote(__z)))
// acos
static float
_TG_ATTRS
__tg_acos(float __x) {return acosf(__x);}
static double
_TG_ATTRS
__tg_acos(double __x) {return acos(__x);}
static long double
_TG_ATTRS
__tg_acos(long double __x) {return acosl(__x);}
static float _Complex
_TG_ATTRS