// vim: ft=cpp
#include <math.h>

/*[[[cog code generation

builtins_single = [
    "acos", "asin", "atan", "cos", "cosh", "exp", "fabs",
    "floor", "log10", "log", "sin", "sinh", "sqrt", "tan", "tanh",
    ]

builtins_double = ["atan2", "fmod", "pow"]

builtins_intp = [
    "frexp", "ldexp", "modf", 
    ]

for fname in builtins_single:
    cog.outl(f"double      {fname}  (double x)      {{ return __builtin_{fname}(x); }}")
    cog.outl(f"float       {fname}f (float x)       {{ return __builtin_{fname}f(x); }}")
    cog.outl(f"long double {fname}l (long double x) {{ return __builtin_{fname}l(x); }}")
    cog.outl()

for fname in builtins_double:
    cog.outl(f"double      {fname}  (double x, double y)           {{ return __builtin_{fname}(x, y); }}")
    cog.outl(f"float       {fname}f (float x, float y)             {{ return __builtin_{fname}f(x, y); }}")
    cog.outl(f"long double {fname}l (long double x, long double y) {{ return __builtin_{fname}l(x, y); }}")
    cog.outl()

]]]*/
/// [[[end]]]

double ldexp(double x, int exp)                         { return __builtin_ldexp(x, exp); }
float ldexpf(float x, int exp)                          { return __builtin_ldexpf(x, exp); }
long double ldexpl(long double x, int exp)              { return __builtin_ldexpl(x, exp); }

double modf(double value, double *iptr)                 { return __builtin_modf(value, iptr); }
float modff(float value, float *iptr)                   { return __builtin_modff(value, iptr); }
long double modfl(long double value, long double *iptr) { return __builtin_modfl(value, iptr); }
