added math::acos, math::asin, math::ceil, math::floor, math::round, math::sinh, math::cosh, math::tanh to awk
This commit is contained in:
parent
6b2f1f8771
commit
0c5d9eee9c
8
qse/configure
vendored
8
qse/configure
vendored
@ -17674,7 +17674,7 @@ done
|
|||||||
|
|
||||||
OLDLIBS="$LIBS"
|
OLDLIBS="$LIBS"
|
||||||
LIBS="$LIBM $LIBS"
|
LIBS="$LIBM $LIBS"
|
||||||
for ac_func in powl fmodl sinl cosl tanl atanl atan2l logl log10l expl sqrtl ceill floorl roundl
|
for ac_func in powl fmodl sinl cosl tanl sinhl coshl tanhl asinl acosl atanl atan2l logl log10l expl sqrtl ceill floorl roundl
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
@ -17686,7 +17686,7 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_func in pow fmod sin cos tan atan atan2 log log10 exp sqrt ceil floor round
|
for ac_func in pow fmod sin cos tan sinh cosh tanh asin acos atan atan2 log log10 exp sqrt ceil floor round
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
@ -17698,7 +17698,7 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_func in powf fmodf sinf cosf tanf atanf atan2f logf log10f expf sqrtf ceilf floorf roundf
|
for ac_func in powf fmodf sinf cosf tanf sinhf coshf tanhf asinf acosf atanf atan2f logf log10f expf sqrtf ceilf floorf roundf
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
@ -20131,7 +20131,7 @@ fi
|
|||||||
|
|
||||||
OLDLIBS="$LIBS"
|
OLDLIBS="$LIBS"
|
||||||
LIBS="$LIBM $LIBS"
|
LIBS="$LIBM $LIBS"
|
||||||
for ac_func in powq fmodq sinq cosq tanq atanq atan2q logq log10q expq sqrtq ceilq floorq roundq
|
for ac_func in powq fmodq sinq cosq tanq sinhq coshq tanhq asinq acosq atanq atan2q logq log10q expq sqrtq ceilq floorq roundq
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
@ -154,9 +154,9 @@ AC_CHECK_FUNCS([_vsnprintf _vsnwprintf])
|
|||||||
|
|
||||||
OLDLIBS="$LIBS"
|
OLDLIBS="$LIBS"
|
||||||
LIBS="$LIBM $LIBS"
|
LIBS="$LIBM $LIBS"
|
||||||
AC_CHECK_FUNCS([powl fmodl sinl cosl tanl atanl atan2l logl log10l expl sqrtl ceill floorl roundl])
|
AC_CHECK_FUNCS([powl fmodl sinl cosl tanl sinhl coshl tanhl asinl acosl atanl atan2l logl log10l expl sqrtl ceill floorl roundl])
|
||||||
AC_CHECK_FUNCS([pow fmod sin cos tan atan atan2 log log10 exp sqrt ceil floor round])
|
AC_CHECK_FUNCS([pow fmod sin cos tan sinh cosh tanh asin acos atan atan2 log log10 exp sqrt ceil floor round])
|
||||||
AC_CHECK_FUNCS([powf fmodf sinf cosf tanf atanf atan2f logf log10f expf sqrtf ceilf floorf roundf])
|
AC_CHECK_FUNCS([powf fmodf sinf cosf tanf sinhf coshf tanhf asinf acosf atanf atan2f logf log10f expf sqrtf ceilf floorf roundf])
|
||||||
LIBS="$OLDLIBS"
|
LIBS="$OLDLIBS"
|
||||||
|
|
||||||
dnl OLDLIBS="$LIBS"
|
dnl OLDLIBS="$LIBS"
|
||||||
@ -459,7 +459,7 @@ then
|
|||||||
|
|
||||||
OLDLIBS="$LIBS"
|
OLDLIBS="$LIBS"
|
||||||
LIBS="$LIBM $LIBS"
|
LIBS="$LIBM $LIBS"
|
||||||
AC_CHECK_FUNCS([powq fmodq sinq cosq tanq atanq atan2q logq log10q expq sqrtq ceilq floorq roundq])
|
AC_CHECK_FUNCS([powq fmodq sinq cosq tanq sinhq coshq tanhq asinq acosq atanq atan2q logq log10q expq sqrtq ceilq floorq roundq])
|
||||||
AC_CHECK_FUNCS([strtoflt128])
|
AC_CHECK_FUNCS([strtoflt128])
|
||||||
LIBS="$OLDLIBS"
|
LIBS="$OLDLIBS"
|
||||||
fi
|
fi
|
||||||
|
@ -3,6 +3,18 @@
|
|||||||
/* Define if building universal (internal helper macro) */
|
/* Define if building universal (internal helper macro) */
|
||||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `acos' function. */
|
||||||
|
#undef HAVE_ACOS
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `acosf' function. */
|
||||||
|
#undef HAVE_ACOSF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `acosl' function. */
|
||||||
|
#undef HAVE_ACOSL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `acosq' function. */
|
||||||
|
#undef HAVE_ACOSQ
|
||||||
|
|
||||||
/* Define to 1 if you have the `argz_add' function. */
|
/* Define to 1 if you have the `argz_add' function. */
|
||||||
#undef HAVE_ARGZ_ADD
|
#undef HAVE_ARGZ_ADD
|
||||||
|
|
||||||
@ -27,6 +39,18 @@
|
|||||||
/* Define to 1 if you have the `argz_stringify' function. */
|
/* Define to 1 if you have the `argz_stringify' function. */
|
||||||
#undef HAVE_ARGZ_STRINGIFY
|
#undef HAVE_ARGZ_STRINGIFY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `asin' function. */
|
||||||
|
#undef HAVE_ASIN
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `asinf' function. */
|
||||||
|
#undef HAVE_ASINF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `asinl' function. */
|
||||||
|
#undef HAVE_ASINL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `asinq' function. */
|
||||||
|
#undef HAVE_ASINQ
|
||||||
|
|
||||||
/* Define to 1 if you have the `atan' function. */
|
/* Define to 1 if you have the `atan' function. */
|
||||||
#undef HAVE_ATAN
|
#undef HAVE_ATAN
|
||||||
|
|
||||||
@ -81,6 +105,18 @@
|
|||||||
/* Define to 1 if you have the `cosf' function. */
|
/* Define to 1 if you have the `cosf' function. */
|
||||||
#undef HAVE_COSF
|
#undef HAVE_COSF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `cosh' function. */
|
||||||
|
#undef HAVE_COSH
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `coshf' function. */
|
||||||
|
#undef HAVE_COSHF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `coshl' function. */
|
||||||
|
#undef HAVE_COSHL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `coshq' function. */
|
||||||
|
#undef HAVE_COSHQ
|
||||||
|
|
||||||
/* Define to 1 if you have the `cosl' function. */
|
/* Define to 1 if you have the `cosl' function. */
|
||||||
#undef HAVE_COSL
|
#undef HAVE_COSL
|
||||||
|
|
||||||
@ -407,6 +443,18 @@
|
|||||||
/* Define to 1 if you have the `sinf' function. */
|
/* Define to 1 if you have the `sinf' function. */
|
||||||
#undef HAVE_SINF
|
#undef HAVE_SINF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sinh' function. */
|
||||||
|
#undef HAVE_SINH
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sinhf' function. */
|
||||||
|
#undef HAVE_SINHF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sinhl' function. */
|
||||||
|
#undef HAVE_SINHL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sinhq' function. */
|
||||||
|
#undef HAVE_SINHQ
|
||||||
|
|
||||||
/* Define to 1 if you have the `sinl' function. */
|
/* Define to 1 if you have the `sinl' function. */
|
||||||
#undef HAVE_SINL
|
#undef HAVE_SINL
|
||||||
|
|
||||||
@ -571,6 +619,18 @@
|
|||||||
/* Define to 1 if you have the `tanf' function. */
|
/* Define to 1 if you have the `tanf' function. */
|
||||||
#undef HAVE_TANF
|
#undef HAVE_TANF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `tanh' function. */
|
||||||
|
#undef HAVE_TANH
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `tanhf' function. */
|
||||||
|
#undef HAVE_TANHF
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `tanhl' function. */
|
||||||
|
#undef HAVE_TANHL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `tanhq' function. */
|
||||||
|
#undef HAVE_TANHQ
|
||||||
|
|
||||||
/* Define to 1 if you have the `tanl' function. */
|
/* Define to 1 if you have the `tanl' function. */
|
||||||
#undef HAVE_TANL
|
#undef HAVE_TANL
|
||||||
|
|
||||||
|
@ -1269,7 +1269,7 @@ oops:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fnc_math_1 (
|
int qse_awk_fnc_math_1 (
|
||||||
qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi, qse_awk_math1_t f)
|
qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi, qse_awk_math1_t f)
|
||||||
{
|
{
|
||||||
qse_size_t nargs;
|
qse_size_t nargs;
|
||||||
@ -1293,7 +1293,7 @@ static int fnc_math_1 (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fnc_math_2 (
|
int qse_awk_fnc_math_2 (
|
||||||
qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi, qse_awk_math2_t f)
|
qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi, qse_awk_math2_t f)
|
||||||
{
|
{
|
||||||
qse_size_t nargs;
|
qse_size_t nargs;
|
||||||
@ -1323,47 +1323,47 @@ static int fnc_math_2 (
|
|||||||
|
|
||||||
int qse_awk_fnc_sin (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_sin (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_1 (rtx, fi, rtx->awk->prm.math.sin);
|
return qse_awk_fnc_math_1 (rtx, fi, rtx->awk->prm.math.sin);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_awk_fnc_cos (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_cos (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_1 (rtx, fi, rtx->awk->prm.math.cos);
|
return qse_awk_fnc_math_1 (rtx, fi, rtx->awk->prm.math.cos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_awk_fnc_tan (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_tan (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_1 (rtx, fi, rtx->awk->prm.math.tan);
|
return qse_awk_fnc_math_1 (rtx, fi, rtx->awk->prm.math.tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_awk_fnc_atan (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_atan (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_1 (rtx, fi, rtx->awk->prm.math.atan);
|
return qse_awk_fnc_math_1 (rtx, fi, rtx->awk->prm.math.atan);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_awk_fnc_atan2 (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_atan2 (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_2 (rtx, fi, rtx->awk->prm.math.atan2);
|
return qse_awk_fnc_math_2 (rtx, fi, rtx->awk->prm.math.atan2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_awk_fnc_log (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_log (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_1 (rtx, fi, rtx->awk->prm.math.log);
|
return qse_awk_fnc_math_1 (rtx, fi, rtx->awk->prm.math.log);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_awk_fnc_log10 (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_log10 (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_1 (rtx, fi, rtx->awk->prm.math.log10);
|
return qse_awk_fnc_math_1 (rtx, fi, rtx->awk->prm.math.log10);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_awk_fnc_exp (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_exp (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_1 (rtx, fi, rtx->awk->prm.math.exp);
|
return qse_awk_fnc_math_1 (rtx, fi, rtx->awk->prm.math.exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int qse_awk_fnc_sqrt (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
int qse_awk_fnc_sqrt (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
{
|
{
|
||||||
return fnc_math_1 (rtx, fi, rtx->awk->prm.math.sqrt);
|
return qse_awk_fnc_math_1 (rtx, fi, rtx->awk->prm.math.sqrt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fnc_int (qse_awk_rtx_t* run, const qse_awk_fnc_info_t* fi)
|
static int fnc_int (qse_awk_rtx_t* run, const qse_awk_fnc_info_t* fi)
|
||||||
|
@ -64,6 +64,11 @@ int qse_awk_fnc_log10 (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi);
|
|||||||
int qse_awk_fnc_exp (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi);
|
int qse_awk_fnc_exp (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi);
|
||||||
int qse_awk_fnc_sqrt (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi);
|
int qse_awk_fnc_sqrt (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi);
|
||||||
|
|
||||||
|
|
||||||
|
int qse_awk_fnc_math_1 (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi, qse_awk_math1_t f);
|
||||||
|
int qse_awk_fnc_math_2 (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi, qse_awk_math2_t f);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,6 +24,188 @@
|
|||||||
#include "../cmn/mem.h"
|
#include "../cmn/mem.h"
|
||||||
#include "fnc.h"
|
#include "fnc.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#if defined(HAVE_QUADMATH_H)
|
||||||
|
# include <quadmath.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(QSE_HAVE_CONFIG_H)
|
||||||
|
# if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
|
# define HAVE_CEIL
|
||||||
|
# define HAVE_FLOOR
|
||||||
|
# define HAVE_ROUND
|
||||||
|
# define HAVE_SINH
|
||||||
|
# define HAVE_COSH
|
||||||
|
# define HAVE_TANH
|
||||||
|
# define HAVE_ASIN
|
||||||
|
# define HAVE_ACOS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static qse_awk_flt_t math_ceil (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
|
{
|
||||||
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_CEILQ)
|
||||||
|
return ceilq (x);
|
||||||
|
#elif defined(HAVE_CEILL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
|
||||||
|
return ceill (x);
|
||||||
|
#elif defined(HAVE_CEIL)
|
||||||
|
return ceil (x);
|
||||||
|
#elif defined(HAVE_CEILF)
|
||||||
|
return ceilf (x);
|
||||||
|
#else
|
||||||
|
#error ### no ceil function available ###
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static qse_awk_flt_t math_floor (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
|
{
|
||||||
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_FLOORQ)
|
||||||
|
return floorq (x);
|
||||||
|
#elif defined(HAVE_FLOORL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
|
||||||
|
return floorl (x);
|
||||||
|
#elif defined(HAVE_FLOOR)
|
||||||
|
return floor (x);
|
||||||
|
#elif defined(HAVE_FLOORF)
|
||||||
|
return floorf (x);
|
||||||
|
#else
|
||||||
|
#error ### no floor function available ###
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static qse_awk_flt_t math_round (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
|
{
|
||||||
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_ROUNDQ)
|
||||||
|
return roundq (x);
|
||||||
|
#elif defined(HAVE_ROUNDL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
|
||||||
|
return roundl (x);
|
||||||
|
#elif defined(HAVE_ROUND)
|
||||||
|
return round (x);
|
||||||
|
#elif defined(HAVE_ROUNDF)
|
||||||
|
return roundf (x);
|
||||||
|
#else
|
||||||
|
#error ### no round function available ###
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static qse_awk_flt_t math_sinh (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
|
{
|
||||||
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_SINHQ)
|
||||||
|
return sinhq (x);
|
||||||
|
#elif defined(HAVE_SINHL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
|
||||||
|
return sinhl (x);
|
||||||
|
#elif defined(HAVE_SINH)
|
||||||
|
return sinh (x);
|
||||||
|
#elif defined(HAVE_SINHF)
|
||||||
|
return sinhf (x);
|
||||||
|
#else
|
||||||
|
#error ### no sinh function available ###
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static qse_awk_flt_t math_cosh (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
|
{
|
||||||
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_COSHQ)
|
||||||
|
return coshq (x);
|
||||||
|
#elif defined(HAVE_COSHL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
|
||||||
|
return coshl (x);
|
||||||
|
#elif defined(HAVE_COSH)
|
||||||
|
return cosh (x);
|
||||||
|
#elif defined(HAVE_COSHF)
|
||||||
|
return coshf (x);
|
||||||
|
#else
|
||||||
|
#error ### no cosh function available ###
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static qse_awk_flt_t math_tanh (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
|
{
|
||||||
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_TANHQ)
|
||||||
|
return tanhq (x);
|
||||||
|
#elif defined(HAVE_TANHL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
|
||||||
|
return tanhl (x);
|
||||||
|
#elif defined(HAVE_TANH)
|
||||||
|
return tanh (x);
|
||||||
|
#elif defined(HAVE_TANHF)
|
||||||
|
return tanhf (x);
|
||||||
|
#else
|
||||||
|
#error ### no tanh function available ###
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static qse_awk_flt_t math_asin (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
|
{
|
||||||
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_ASINQ)
|
||||||
|
return asinq (x);
|
||||||
|
#elif defined(HAVE_ASINL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
|
||||||
|
return asinl (x);
|
||||||
|
#elif defined(HAVE_ASIN)
|
||||||
|
return asin (x);
|
||||||
|
#elif defined(HAVE_ASINF)
|
||||||
|
return asinf (x);
|
||||||
|
#else
|
||||||
|
#error ### no asin function available ###
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static qse_awk_flt_t math_acos (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
|
{
|
||||||
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_ACOSQ)
|
||||||
|
return acosq (x);
|
||||||
|
#elif defined(HAVE_ACOSL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
|
||||||
|
return acosl (x);
|
||||||
|
#elif defined(HAVE_ACOS)
|
||||||
|
return acos (x);
|
||||||
|
#elif defined(HAVE_ACOSF)
|
||||||
|
return acosf (x);
|
||||||
|
#else
|
||||||
|
#error ### no acos function available ###
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fnc_ceil (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
|
{
|
||||||
|
return qse_awk_fnc_math_1 (rtx, fi, math_ceil);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fnc_floor (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
|
{
|
||||||
|
return qse_awk_fnc_math_1 (rtx, fi, math_floor);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fnc_round (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
|
{
|
||||||
|
return qse_awk_fnc_math_1 (rtx, fi, math_round);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fnc_sinh (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
|
{
|
||||||
|
return qse_awk_fnc_math_1 (rtx, fi, math_sinh);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fnc_cosh (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
|
{
|
||||||
|
return qse_awk_fnc_math_1 (rtx, fi, math_cosh);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fnc_tanh (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
|
{
|
||||||
|
return qse_awk_fnc_math_1 (rtx, fi, math_tanh);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fnc_asin (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
|
{
|
||||||
|
return qse_awk_fnc_math_1 (rtx, fi, math_asin);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fnc_acos (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
||||||
|
{
|
||||||
|
return qse_awk_fnc_math_1 (rtx, fi, math_acos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
typedef struct fnctab_t fnctab_t;
|
typedef struct fnctab_t fnctab_t;
|
||||||
struct fnctab_t
|
struct fnctab_t
|
||||||
{
|
{
|
||||||
@ -34,16 +216,23 @@ struct fnctab_t
|
|||||||
static fnctab_t fnctab[] =
|
static fnctab_t fnctab[] =
|
||||||
{
|
{
|
||||||
/* keep this table sorted for binary search in query(). */
|
/* keep this table sorted for binary search in query(). */
|
||||||
|
{ QSE_T("acos"), { { 1, 1, QSE_NULL }, fnc_acos, 0 } },
|
||||||
|
{ QSE_T("asin"), { { 1, 1, QSE_NULL }, fnc_asin, 0 } },
|
||||||
{ QSE_T("atan"), { { 1, 1, QSE_NULL }, qse_awk_fnc_atan, 0 } },
|
{ QSE_T("atan"), { { 1, 1, QSE_NULL }, qse_awk_fnc_atan, 0 } },
|
||||||
{ QSE_T("atan2"), { { 2, 2, QSE_NULL }, qse_awk_fnc_atan2, 0 } },
|
{ QSE_T("atan2"), { { 2, 2, QSE_NULL }, qse_awk_fnc_atan2, 0 } },
|
||||||
|
{ QSE_T("ceil"), { { 1, 1, QSE_NULL }, fnc_ceil, 0 } },
|
||||||
{ QSE_T("cos"), { { 1, 1, QSE_NULL }, qse_awk_fnc_cos, 0 } },
|
{ QSE_T("cos"), { { 1, 1, QSE_NULL }, qse_awk_fnc_cos, 0 } },
|
||||||
|
{ QSE_T("cosh"), { { 1, 1, QSE_NULL }, fnc_cosh, 0 } },
|
||||||
{ QSE_T("exp"), { { 1, 1, QSE_NULL }, qse_awk_fnc_exp, 0 } },
|
{ QSE_T("exp"), { { 1, 1, QSE_NULL }, qse_awk_fnc_exp, 0 } },
|
||||||
|
{ QSE_T("floor"), { { 1, 1, QSE_NULL }, fnc_floor, 0 } },
|
||||||
{ QSE_T("log"), { { 1, 1, QSE_NULL }, qse_awk_fnc_log, 0 } },
|
{ QSE_T("log"), { { 1, 1, QSE_NULL }, qse_awk_fnc_log, 0 } },
|
||||||
{ QSE_T("log10"), { { 1, 1, QSE_NULL }, qse_awk_fnc_log10, 0 } },
|
{ QSE_T("log10"), { { 1, 1, QSE_NULL }, qse_awk_fnc_log10, 0 } },
|
||||||
|
{ QSE_T("round"), { { 1, 1, QSE_NULL }, fnc_round, 0 } },
|
||||||
{ QSE_T("sin"), { { 1, 1, QSE_NULL }, qse_awk_fnc_sin, 0 } },
|
{ QSE_T("sin"), { { 1, 1, QSE_NULL }, qse_awk_fnc_sin, 0 } },
|
||||||
|
{ QSE_T("sinh"), { { 1, 1, QSE_NULL }, fnc_sinh, 0 } },
|
||||||
{ QSE_T("sqrt"), { { 1, 1, QSE_NULL }, qse_awk_fnc_sqrt, 0 } },
|
{ QSE_T("sqrt"), { { 1, 1, QSE_NULL }, qse_awk_fnc_sqrt, 0 } },
|
||||||
{ QSE_T("tan"), { { 1, 1, QSE_NULL }, qse_awk_fnc_tan, 0 } },
|
{ QSE_T("tan"), { { 1, 1, QSE_NULL }, qse_awk_fnc_tan, 0 } },
|
||||||
|
{ QSE_T("tanh"), { { 1, 1, QSE_NULL }, fnc_tanh, 0 } }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
|
static int query (qse_awk_mod_t* mod, qse_awk_t* awk, const qse_char_t* name, qse_awk_mod_sym_t* sym)
|
||||||
|
@ -52,9 +52,7 @@
|
|||||||
# define INCL_DOSERRORS
|
# define INCL_DOSERRORS
|
||||||
# include <os2.h>
|
# include <os2.h>
|
||||||
#elif defined(__DOS__)
|
#elif defined(__DOS__)
|
||||||
# if !defined(QSE_ENABLE_STATIC_MODULE)
|
/* nothing to include */
|
||||||
# include <cwdllfnc.h>
|
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <ltdl.h>
|
# include <ltdl.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user