2004-01-22 05:43:18 +00:00
|
|
|
/*
|
|
|
|
rua_math.c
|
|
|
|
|
|
|
|
Floating point math api for ruamoko
|
|
|
|
|
|
|
|
Copyright (C) 2003 Robert F Merrill
|
|
|
|
|
|
|
|
Author: Robert F Merrill
|
|
|
|
Date: 2003-01-22
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2023-09-10 05:13:56 +00:00
|
|
|
#define _GNU_SOURCE
|
2004-01-22 05:43:18 +00:00
|
|
|
#include <stdlib.h>
|
2012-05-21 23:23:22 +00:00
|
|
|
#include <math.h>
|
2004-01-22 05:43:18 +00:00
|
|
|
|
|
|
|
#include "QF/cmd.h"
|
|
|
|
#include "QF/hash.h"
|
|
|
|
#include "QF/progs.h"
|
|
|
|
#include "QF/sys.h"
|
|
|
|
|
|
|
|
#include "rua_internal.h"
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_sinf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = sinf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
2023-09-10 05:13:56 +00:00
|
|
|
static void
|
|
|
|
bi_sincosf (progs_t *pr, void *data)
|
|
|
|
{
|
|
|
|
float *vec = &R_var (pr, float);
|
|
|
|
float x = P_FLOAT (pr, 0);
|
|
|
|
sincosf (x, &vec[0], &vec[1]);
|
|
|
|
}
|
|
|
|
|
2004-01-22 05:43:18 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_cosf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = cosf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_tanf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = tanf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_asinf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = asinf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_acosf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = acosf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_atanf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = atanf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_atan2f (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = atan2f (P_FLOAT (pr, 0), P_FLOAT (pr, 1));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
2021-06-19 02:23:51 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_expf (progs_t *pr, void *data)
|
2021-06-19 02:23:51 +00:00
|
|
|
{
|
|
|
|
R_FLOAT (pr) = expf (P_FLOAT (pr, 0));
|
|
|
|
}
|
|
|
|
|
2004-01-22 05:43:18 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_logf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = logf (P_FLOAT (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_log2f (progs_t *pr, void *data)
|
2011-12-10 03:36:41 +00:00
|
|
|
{
|
2012-02-05 05:23:33 +00:00
|
|
|
#ifdef HAVE_LOG2F
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = log2f (P_FLOAT (pr, 0));
|
2012-02-05 05:23:33 +00:00
|
|
|
#else
|
|
|
|
R_FLOAT (pr) = logf (P_FLOAT (pr, 0)) / M_LOG2E;
|
|
|
|
#endif
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_log10f (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = log10f (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_powf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = powf (P_FLOAT (pr, 0), P_FLOAT (pr, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_sqrtf (progs_t *pr, void *data)
|
2011-12-10 03:36:41 +00:00
|
|
|
{
|
|
|
|
R_FLOAT (pr) = sqrtf (P_FLOAT (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_cbrtf (progs_t *pr, void *data)
|
2011-12-10 03:36:41 +00:00
|
|
|
{
|
|
|
|
R_FLOAT (pr) = cbrtf (P_FLOAT (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_hypotf (progs_t *pr, void *data)
|
2011-12-10 03:36:41 +00:00
|
|
|
{
|
|
|
|
R_FLOAT (pr) = hypotf (P_FLOAT (pr, 0), P_FLOAT (pr, 1));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_sinhf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = sinhf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
2023-09-10 05:13:56 +00:00
|
|
|
static void
|
|
|
|
bi_sincoshf (progs_t *pr, void *data)
|
|
|
|
{
|
|
|
|
float *vec = &R_var (pr, float);
|
|
|
|
float x = P_FLOAT (pr, 0);
|
|
|
|
vec[0] = sinhf (x);
|
|
|
|
vec[1] = coshf (x);
|
|
|
|
}
|
|
|
|
|
2004-01-22 05:43:18 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_coshf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = coshf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_tanhf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = tanhf (P_FLOAT (pr, 0));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_asinhf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2004-01-22 06:26:55 +00:00
|
|
|
double y = P_FLOAT (pr, 0);
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = logf (y + sqrtf (y * y + 1));
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_acoshf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2004-01-22 06:26:55 +00:00
|
|
|
double y = P_FLOAT (pr, 0);
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = logf (y + sqrtf (y * y - 1));
|
2004-01-22 06:27:56 +00:00
|
|
|
}
|
2004-01-22 05:43:18 +00:00
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_atanhf (progs_t *pr, void *data)
|
2004-01-22 05:43:18 +00:00
|
|
|
{
|
2004-01-22 06:26:55 +00:00
|
|
|
double y = P_FLOAT (pr, 0);
|
2011-12-10 03:36:41 +00:00
|
|
|
R_FLOAT (pr) = logf ((1 + y) / (1 - y)) / 2;
|
2004-01-22 06:27:56 +00:00
|
|
|
}
|
2004-01-22 05:43:18 +00:00
|
|
|
|
2020-02-15 14:22:56 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_floor (progs_t *pr, void *data)
|
2020-02-15 14:22:56 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = floor (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_ceil (progs_t *pr, void *data)
|
2020-02-15 14:22:56 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = ceil (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_fabs (progs_t *pr, void *data)
|
2020-02-15 14:22:56 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = fabs (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
2020-02-14 07:38:37 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_sin (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = sin (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
2023-09-10 05:13:56 +00:00
|
|
|
static void
|
|
|
|
bi_sincos (progs_t *pr, void *data)
|
|
|
|
{
|
|
|
|
double *vec = &R_var (pr, double);
|
|
|
|
float x = P_FLOAT (pr, 0);
|
|
|
|
sincos (x, &vec[0], &vec[1]);
|
|
|
|
}
|
|
|
|
|
2020-02-14 07:38:37 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_cos (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = cos (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_tan (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = tan (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_asin (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = asin (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_acos (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = acos (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_atan (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = atan (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_atan2 (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = atan2 (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1));
|
|
|
|
}
|
|
|
|
|
2021-06-19 02:23:51 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_exp (progs_t *pr, void *data)
|
2021-06-19 02:23:51 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = exp (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
2020-02-14 07:38:37 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_log (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = log (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_log2 (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = log (P_DOUBLE (pr, 0)) / M_LOG2E;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_log10 (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = log10 (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_pow (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = pow (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_sqrt (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = sqrt (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_cbrt (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = cbrt (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_hypot (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = hypot (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_sinh (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = sinh (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
2023-09-10 05:13:56 +00:00
|
|
|
static void
|
|
|
|
bi_sincosh (progs_t *pr, void *data)
|
|
|
|
{
|
|
|
|
float *vec = &R_var (pr, float);
|
|
|
|
float x = P_FLOAT (pr, 0);
|
|
|
|
vec[0] = sinh (x);
|
|
|
|
vec[1] = cosh (x);
|
|
|
|
}
|
|
|
|
|
2020-02-14 07:38:37 +00:00
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_cosh (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = cosh (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_tanh (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
R_DOUBLE (pr) = tanh (P_DOUBLE (pr, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_asinh (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
double y = P_DOUBLE (pr, 0);
|
|
|
|
R_DOUBLE (pr) = log (y + sqrt (y * y + 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_acosh (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
double y = P_DOUBLE (pr, 0);
|
|
|
|
R_DOUBLE (pr) = log (y + sqrt (y * y - 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-02-14 03:28:38 +00:00
|
|
|
bi_atanh (progs_t *pr, void *data)
|
2020-02-14 07:38:37 +00:00
|
|
|
{
|
|
|
|
double y = P_DOUBLE (pr, 0);
|
|
|
|
R_DOUBLE (pr) = log ((1 + y) / (1 - y)) / 2;
|
|
|
|
}
|
|
|
|
|
2022-01-23 12:54:03 +00:00
|
|
|
#define bi(x,np,params...) {#x, bi_##x, -1, np, {params}}
|
|
|
|
#define p(type) PR_PARAM(type)
|
2004-01-22 05:43:18 +00:00
|
|
|
static builtin_t builtins[] = {
|
2022-01-23 12:54:03 +00:00
|
|
|
{"sin|f", bi_sinf, -1, 1, {p(float)}},
|
2023-09-10 05:13:56 +00:00
|
|
|
{"sincos|f",bi_sincosf, -1, 1, {p(float)}},
|
2022-01-23 12:54:03 +00:00
|
|
|
{"cos|f", bi_cosf, -1, 1, {p(float)}},
|
|
|
|
{"tan|f", bi_tanf, -1, 1, {p(float)}},
|
|
|
|
{"asin|f", bi_asinf, -1, 1, {p(float)}},
|
|
|
|
{"acos|f", bi_acosf, -1, 1, {p(float)}},
|
|
|
|
{"atan|f", bi_atanf, -1, 1, {p(float)}},
|
|
|
|
{"atan2|ff",bi_atan2f, -1, 2, {p(float), p(float)}},
|
|
|
|
{"exp|f", bi_expf, -1, 1, {p(float)}},
|
|
|
|
{"log|f", bi_logf, -1, 1, {p(float)}},
|
|
|
|
{"log2|f", bi_log2f, -1, 1, {p(float)}},
|
|
|
|
{"log10|f", bi_log10f, -1, 1, {p(float)}},
|
|
|
|
{"pow|ff", bi_powf, -1, 2, {p(float), p(float)}},
|
|
|
|
{"sqrt|f", bi_sqrtf, -1, 1, {p(float)}},
|
|
|
|
{"cbrt|f", bi_cbrtf, -1, 1, {p(float)}},
|
|
|
|
{"hypot|ff",bi_hypotf, -1, 2, {p(float), p(float)}},
|
|
|
|
{"sinh|f", bi_sinhf, -1, 1, {p(float)}},
|
2023-09-10 05:13:56 +00:00
|
|
|
{"sincosh|f",bi_sincoshf,-1, 1, {p(float)}},
|
2022-01-23 12:54:03 +00:00
|
|
|
{"cosh|f", bi_coshf, -1, 1, {p(float)}},
|
|
|
|
{"tanh|f", bi_tanhf, -1, 1, {p(float)}},
|
|
|
|
{"asinh|f", bi_asinhf, -1, 1, {p(float)}},
|
|
|
|
{"acosh|f", bi_acoshf, -1, 1, {p(float)}},
|
|
|
|
{"atanh|f", bi_atanhf, -1, 1, {p(float)}},
|
|
|
|
{"floor|d", bi_floor, -1, 1, {p(double)}}, // float version in pr_cmds
|
|
|
|
{"ceil|d", bi_ceil, -1, 1, {p(double)}}, // float version in pr_cmds
|
|
|
|
{"fabs|d", bi_fabs, -1, 1, {p(double)}}, // float version in pr_cmds
|
|
|
|
{"sin|d", bi_sin, -1, 1, {p(double)}},
|
2023-09-10 05:13:56 +00:00
|
|
|
{"sincos|d",bi_sincos, -1, 1, {p(double)}},
|
2022-01-23 12:54:03 +00:00
|
|
|
{"cos|d", bi_cos, -1, 1, {p(double)}},
|
|
|
|
{"tan|d", bi_tan, -1, 1, {p(double)}},
|
|
|
|
{"asin|d", bi_asin, -1, 1, {p(double)}},
|
|
|
|
{"acos|d", bi_acos, -1, 1, {p(double)}},
|
|
|
|
{"atan|d", bi_atan, -1, 1, {p(double)}},
|
|
|
|
{"atan2|dd",bi_atan2, -1, 2, {p(double), p(double)}},
|
|
|
|
{"exp|d", bi_exp, -1, 1, {p(double)}},
|
|
|
|
{"log|d", bi_log, -1, 1, {p(double)}},
|
|
|
|
{"log2|d", bi_log2, -1, 1, {p(double)}},
|
|
|
|
{"log10|d", bi_log10, -1, 1, {p(double)}},
|
|
|
|
{"pow|dd", bi_pow, -1, 2, {p(double), p(double)}},
|
|
|
|
{"sqrt|d", bi_sqrt, -1, 1, {p(double)}},
|
|
|
|
{"cbrt|d", bi_cbrt, -1, 1, {p(double)}},
|
|
|
|
{"hypot|dd",bi_hypot, -1, 2, {p(double), p(double)}},
|
|
|
|
{"sinh|d", bi_sinh, -1, 1, {p(double)}},
|
2023-09-10 05:13:56 +00:00
|
|
|
{"sincosh|d",bi_sincosh,-1, 1, {p(double)}},
|
2022-01-23 12:54:03 +00:00
|
|
|
{"cosh|d", bi_cosh, -1, 1, {p(double)}},
|
|
|
|
{"tanh|d", bi_tanh, -1, 1, {p(double)}},
|
|
|
|
{"asinh|d", bi_asinh, -1, 1, {p(double)}},
|
|
|
|
{"acosh|d", bi_acosh, -1, 1, {p(double)}},
|
|
|
|
{"atanh|d", bi_atanh, -1, 1, {p(double)}},
|
2004-01-22 05:43:18 +00:00
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
RUA_Math_Init (progs_t *pr, int secure)
|
|
|
|
{
|
2022-01-23 15:20:05 +00:00
|
|
|
PR_RegisterBuiltins (pr, builtins, 0);
|
2004-01-22 05:43:18 +00:00
|
|
|
}
|