Format with clang-format

This commit is contained in:
dosisod 2021-03-10 21:24:29 -08:00
parent c04f99df86
commit de5a638994

View file

@ -1,8 +1,8 @@
#ifndef LIBC_ISYSTEM_TGMATH_H_ #ifndef LIBC_ISYSTEM_TGMATH_H_
#define LIBC_ISYSTEM_TGMATH_H_ #define LIBC_ISYSTEM_TGMATH_H_
#include "libc/math.h"
#include "libc/complex.h" #include "libc/complex.h"
#include "libc/math.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
#if __STDC_VERSION__ + 0 >= 201112 #if __STDC_VERSION__ + 0 >= 201112
@ -10,356 +10,319 @@ COSMOPOLITAN_C_START_
/* from https://en.cppreference.com/w/c/numeric/tgmath */ /* from https://en.cppreference.com/w/c/numeric/tgmath */
#define fabs(x) _Generic((x), \ #define fabs(x) \
float : fabsf, \ _Generic((x), float \
default: fabs, \ : fabsf, default \
long double : fabsl, \ : fabs, long double \
complex float : cabsf, \ : fabsl, complex float \
complex double : cabs, \ : cabsf, complex double \
complex long double : cabsl)(x) : cabs, complex long double \
: cabsl)(x)
#define exp(x) _Generic((x), \ #define exp(x) \
float : expf, \ _Generic((x), float \
default: exp, \ : expf, default \
long double : expl, \ : exp, long double \
complex float : cexpf, \ : expl, complex float \
complex double : cexp, \ : cexpf, complex double \
complex long double : cexpl)(x) : cexp, complex long double \
: cexpl)(x)
#define log(x) _Generic((x), \ #define log(x) \
float : logf, \ _Generic((x), float \
default : log, \ : logf, default \
long double : logl, \ : log, long double \
complex float : clogf, \ : logl, complex float \
complex double : clog, \ : clogf, complex double \
complex long double : clogl)(x) : clog, complex long double \
: clogl)(x)
#define pow(x, y) _Generic((x), \ #define pow(x, y) \
float : powf, \ _Generic((x), float \
default : pow, \ : powf, default \
long double : powl, \ : pow, long double \
complex float : cpowf, \ : powl, complex float \
complex double : cpow, \ : cpowf, complex double \
complex long double : cpowl)(x, y) : cpow, complex long double \
: cpowl)(x, y)
#define sqrt(x) _Generic((x), \ #define sqrt(x) \
float : sqrtf, \ _Generic((x), float \
default : sqrt, \ : sqrtf, default \
long double : sqrtl, \ : sqrt, long double \
complex float : csqrtf, \ : sqrtl, complex float \
complex double : csqrt, \ : csqrtf, complex double \
complex long double : csqrtl)(x) : csqrt, complex long double \
: csqrtl)(x)
#define sin(x) _Generic((x), \ #define sin(x) \
float : sinf, \ _Generic((x), float \
default : sin, \ : sinf, default \
long double : sinl, \ : sin, long double \
complex float : csinf, \ : sinl, complex float \
complex double : csin, \ : csinf, complex double \
complex long double : csinl)(x) : csin, complex long double \
: csinl)(x)
#define cos(x) _Generic((x), \ #define cos(x) \
float : cosf, \ _Generic((x), float \
default : cos, \ : cosf, default \
long double : cosl, \ : cos, long double \
complex float : ccosf, \ : cosl, complex float \
complex double : ccos, \ : ccosf, complex double \
complex long double : ccosl)(x) : ccos, complex long double \
: ccosl)(x)
#define tan(x) _Generic((x), \ #define tan(x) \
float : tanf, \ _Generic((x), float \
default : tan, \ : tanf, default \
long double : tanl, \ : tan, long double \
complex float : ctanf, \ : tanl, complex float \
complex double : ctan, \ : ctanf, complex double \
complex long double : ctanl)(x) : ctan, complex long double \
: ctanl)(x)
#define asin(x) _Generic((x), \ #define asin(x) \
float : asinf, \ _Generic((x), float \
default : asin, \ : asinf, default \
long double : asinl, \ : asin, long double \
complex float : casinf, \ : asinl, complex float \
complex double : casin, \ : casinf, complex double \
complex long double : casinl)(x) : casin, complex long double \
: casinl)(x)
#define acos(x) _Generic((x), \ #define acos(x) \
float : acosf, \ _Generic((x), float \
default : acos, \ : acosf, default \
long double : acosl, \ : acos, long double \
complex float : cacosf, \ : acosl, complex float \
complex double : cacos, \ : cacosf, complex double \
complex long double : cacosl)(x) : cacos, complex long double \
: cacosl)(x)
#define atan(x) _Generic((x), \ #define atan(x) \
float : atanf, \ _Generic((x), float \
default : atan, \ : atanf, default \
long double : atanl, \ : atan, long double \
complex float : catanf, \ : atanl, complex float \
complex double : catan, \ : catanf, complex double \
complex long double : catanl)(x) : catan, complex long double \
: catanl)(x)
#define sinh(x) _Generic((x), \ #define sinh(x) \
float : sinhf, \ _Generic((x), float \
default : sinh, \ : sinhf, default \
long double : sinhl, \ : sinh, long double \
complex float : csinhf, \ : sinhl, complex float \
complex double : csinh, \ : csinhf, complex double \
complex long double : csinhl)(x) : csinh, complex long double \
: csinhl)(x)
#define cosh(x) _Generic((x), \ #define cosh(x) \
float : coshf, \ _Generic((x), float \
default : cosh, \ : coshf, default \
long double : coshl, \ : cosh, long double \
complex float : ccoshf, \ : coshl, complex float \
complex double : ccosh, \ : ccoshf, complex double \
complex long double : ccoshl)(x) : ccosh, complex long double \
: ccoshl)(x)
#define tanh(x) _Generic((x), \ #define tanh(x) \
float : tanhf, \ _Generic((x), float \
default : tanh, \ : tanhf, default \
long double : tanhl, \ : tanh, long double \
complex float : ctanhf, \ : tanhl, complex float \
complex double : ctanh, \ : ctanhf, complex double \
complex long double : ctanhl)(x) : ctanh, complex long double \
: ctanhl)(x)
#define asinh(x) _Generic((x), \ #define asinh(x) \
float : asinhf, \ _Generic((x), float \
default : asinh, \ : asinhf, default \
long double : asinhl, \ : asinh, long double \
complex float : casinhf, \ : asinhl, complex float \
complex double : casinh, \ : casinhf, complex double \
complex long double : casinhl)(x) : casinh, complex long double \
: casinhl)(x)
#define acosh(x) _Generic((x), \ #define acosh(x) \
float : acoshf, \ _Generic((x), float \
default : acosh, \ : acoshf, default \
long double : acoshl, \ : acosh, long double \
complex float : cacoshf, \ : acoshl, complex float \
complex double : cacosh, \ : cacoshf, complex double \
complex long double : cacoshl)(x) : cacosh, complex long double \
: cacoshl)(x)
#define atanh(x) _Generic((x), \ #define atanh(x) \
float : atanhf, \ _Generic((x), float \
default : atanh, \ : atanhf, default \
long double : atanhl, \ : atanh, long double \
complex float : catanhf, \ : atanhl, complex float \
complex double : catanh, \ : catanhf, complex double \
complex long double : catanhl)(x) : catanh, complex long double \
: catanhl)(x)
#define atan2(x, y) _Generic((x), \ #define atan2(x, y) \
float : atan2f, \ _Generic((x), float : atan2f, default : atan2, long double : atan2l)(x, y)
default : atan2, \
long double : atan2l)(x, y)
#define cbrt(x) _Generic((x), \ #define cbrt(x) \
float : cbrtf, \ _Generic((x), float : cbrtf, default : cbrt, long double : cbrtl)(x)
default : cbrt, \
long double : cbrtl)(x)
#define ceil(x) _Generic((x), \ #define ceil(x) \
float : ceilf, \ _Generic((x), float : ceilf, default : ceil, long double : ceill)(x)
default : ceil, \
long double : ceill)(x)
#define copysign(x, y) _Generic((x), \ #define copysign(x, y) \
float : copysignf, \ _Generic((x), float \
default : copysign, \ : copysignf, default \
long double : copysignl)(x, y) : copysign, long double \
: copysignl)(x, y)
#define erf(x) _Generic((x), \ #define erf(x) _Generic((x), float : erff, default : erf, long double : erfl)(x)
float : erff, \
default : erf, \
long double : erfl)(x)
#define erfc(x) _Generic((x), \ #define erfc(x) \
float : erfcf, \ _Generic((x), float : erfcf, default : erfc, long double : erfcl)(x)
default : erfc, \
long double : erfcl)(x)
#define exp2(x) _Generic((x), \ #define exp2(x) \
float : exp2f, \ _Generic((x), float : exp2f, default : exp2, long double : exp2l)(x)
default : exp2, \
long double : exp2l)(x)
#define expm1(x) _Generic((x), \ #define expm1(x) \
float : expm1f, \ _Generic((x), float : expm1f, default : expm1, long double : expm1l)(x)
default : expm1, \
long double : expm1l)(x)
#define fdim(x, y) _Generic((x), \ #define fdim(x, y) \
float : fdimf, \ _Generic((x), float : fdimf, default : fdim, long double : fdiml)(x, y)
default : fdim, \
long double : fdiml)(x, y)
#define floor(x) _Generic((x), \ #define floor(x) \
float : floorf, \ _Generic((x), float : floorf, default : floor, long double : floorl)(x)
default : floor, \
long double : floorl)(x)
#define fma(x, y, z) _Generic((x), \ #define fma(x, y, z) \
float : fmaf, \ _Generic((x), float : fmaf, default : fma, long double : fmal)(x, y, z)
default : fma, \
long double : fmal)(x, y, z)
#define fmax(x, y) _Generic((x), \ #define fmax(x, y) \
float : fmaxf, \ _Generic((x), float : fmaxf, default : fmax, long double : fmaxl)(x, y)
default : fmax, \
long double : fmaxl)(x, y)
#define fmin(x, y) _Generic((x), \ #define fmin(x, y) \
float : fminf, \ _Generic((x), float : fminf, default : fmin, long double : fminl)(x, y)
default : fmin, \
long double : fminl)(x, y)
#define fmod(x, y) _Generic((x), \ #define fmod(x, y) \
float : fmodf, \ _Generic((x), float : fmodf, default : fmod, long double : fmodl)(x, y)
default : fmod, \
long double : fmodl)(x, y)
#define frexp(x, y) _Generic((x), \ #define frexp(x, y) \
float : frexpf, \ _Generic((x), float : frexpf, default : frexp, long double : frexpl)(x, y)
default : frexp, \
long double : frexpl)(x, y)
#define hypot(x, y) _Generic((x), \ #define hypot(x, y) \
float : hypotf, \ _Generic((x), float : hypotf, default : hypot, long double : hypotl)(x, y)
default : hypot, \
long double : hypotl)(x, y)
#define ilogb(x) _Generic((x), \ #define ilogb(x) \
float : ilogbf, \ _Generic((x), float : ilogbf, default : ilogb, long double : ilogbl)(x)
default : ilogb, \
long double : ilogbl)(x)
#define ldexp(x, y) _Generic((x), \ #define ldexp(x, y) \
float : ldexpf, \ _Generic((x), float : ldexpf, default : ldexp, long double : ldexpl)(x, y)
default : ldexp, \
long double : ldexpl)(x, y)
#define lgamma(x) _Generic((x), \ #define lgamma(x) \
float : lgammaf, \ _Generic((x), float : lgammaf, default : lgamma, long double : lgammal)(x)
default : lgamma, \
long double : lgammal)(x)
#define llrint(x) _Generic((x), \ #define llrint(x) \
float : llrintf, \ _Generic((x), float : llrintf, default : llrint, long double : llrintl)(x)
default : llrint, \
long double : llrintl)(x)
#define llround(x) _Generic((x), \ #define llround(x) \
float : llroundf, \ _Generic((x), float : llroundf, default : llround, long double : llroundl)(x)
default : llround, \
long double : llroundl)(x)
#define log10(x) _Generic((x), \ #define log10(x) \
float : log10f, \ _Generic((x), float : log10f, default : log10, long double : log10l)(x)
default : log10, \
long double : log10l)(x)
#define log1p(x) _Generic((x), \ #define log1p(x) \
float : log1pf, \ _Generic((x), float : log1pf, default : log1p, long double : log1pl)(x)
default : log1p, \
long double : log1pl)(x)
#define log2(x) _Generic((x), \ #define log2(x) \
float : log2f, \ _Generic((x), float : log2f, default : log2, long double : log2l)(x)
default : log2, \
long double : log2l)(x)
#define logb(x) _Generic((x), \ #define logb(x) \
float : logbf, \ _Generic((x), float : logbf, default : logb, long double : logbl)(x)
default : logb, \
long double : logbl)(x)
#define lrint(x) _Generic((x), \ #define lrint(x) \
float : lrintf, \ _Generic((x), float : lrintf, default : lrint, long double : lrintl)(x)
default : lrint, \
long double : lrintl)(x)
#define lround(x) _Generic((x), \ #define lround(x) \
float : lroundf, \ _Generic((x), float : lroundf, default : lround, long double : lroundl)(x)
default : lround, \
long double : lroundl)(x)
#define nearbyint(x) _Generic((x), \ #define nearbyint(x) \
float : nearbyintf, \ _Generic((x), float \
default : nearbyint, \ : nearbyintf, default \
long double : nearbyintl)(x) : nearbyint, long double \
: nearbyintl)(x)
#define nextafter(x, y) _Generic((x), \ #define nextafter(x, y) \
float : nextafterf, \ _Generic((x), float \
default : nextafter, \ : nextafterf, default \
long double : nextafterl)(x, y) : nextafter, long double \
: nextafterl)(x, y)
#define nexttoward(x, y) _Generic((x), \ #define nexttoward(x, y) \
float : nexttowardf, \ _Generic((x), float \
default : nexttoward, \ : nexttowardf, default \
long double : nexttowardl)(x, y) : nexttoward, long double \
: nexttowardl)(x, y)
#define remainder(x, y) _Generic((x), \ #define remainder(x, y) \
float : remainderf, \ _Generic((x), float \
default : remainder, \ : remainderf, default \
long double : remainderl)(x, y) : remainder, long double \
: remainderl)(x, y)
#define remquo(x, y) _Generic((x), \ #define remquo(x, y) \
float : remquof, \ _Generic((x), float : remquof, default : remquo, long double : remquol)(x, y)
default : remquo, \
long double : remquol)(x, y)
#define rint(x) _Generic((x), \ #define rint(x) \
float : rintf, \ _Generic((x), float : rintf, default : rint, long double : rintl)(x)
default : rint, \
long double : rintl)(x)
#define round(x) _Generic((x), \ #define round(x) \
float : roundf, \ _Generic((x), float : roundf, default : round, long double : roundl)(x)
default : round, \
long double : roundl)(x)
#define scalbln(x, y) _Generic((x), \ #define scalbln(x, y) \
float : scalblnf, \ _Generic((x), float \
default : scalbln, \ : scalblnf, default \
long double : scalblnl)(x, y) : scalbln, long double \
: scalblnl)(x, y)
#define scalbn(x, y) _Generic((x), \ #define scalbn(x, y) \
float : scalbnf, \ _Generic((x), float : scalbnf, default : scalbn, long double : scalbnl)(x, y)
default : scalbn, \
long double : scalbnl)(x, y)
#define tgamma(x) _Generic((x), \ #define tgamma(x) \
float : tgammaf, \ _Generic((x), float : tgammaf, default : tgamma, long double : tgammal)(x)
default : tgamma, \
long double : tgammal)(x)
#define trunc(x) _Generic((x), \ #define trunc(x) \
float : truncf, \ _Generic((x), float : truncf, default : trunc, long double : truncl)(x)
default : trunc, \
long double : truncl)(x)
#define carg(x) _Generic((x), \ #define carg(x) \
complex float : cargf, \ _Generic((x), complex float \
complex default : carg, \ : cargf, complex default \
complex long double : cargl)(x) : carg, complex long double \
: cargl)(x)
#define conj(x) _Generic((x), \ #define conj(x) \
complex float : conjf, \ _Generic((x), complex float \
complex default : conj, \ : conjf, complex default \
complex long double : conjl)(x) : conj, complex long double \
: conjl)(x)
#define creal(x) _Generic((x), \ #define creal(x) \
complex float : crealf, \ _Generic((x), complex float \
complex default : creal, \ : crealf, complex default \
complex long double : creall)(x) : creal, complex long double \
: creall)(x)
#define cimag(x) _Generic((x), \ #define cimag(x) \
complex float : cimagf, \ _Generic((x), complex float \
complex default : cimag, \ : cimagf, complex default \
complex long double : cimagl)(x) : cimag, complex long double \
: cimagl)(x)
#define cproj(x) _Generic((x), \ #define cproj(x) \
complex float : cprojf, \ _Generic((x), complex float \
complex default : cproj, \ : cprojf, complex default \
complex long double : cprojl)(x) : cproj, complex long double \
: cprojl)(x)
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_