[ruamoko] Add bindings for exp()

This commit is contained in:
Bill Currie 2021-06-19 11:23:51 +09:00
parent 2278f5e494
commit 8db1957452
3 changed files with 22 additions and 0 deletions

View file

@ -83,6 +83,12 @@ bi_atan2f (progs_t *pr)
R_FLOAT (pr) = atan2f (P_FLOAT (pr, 0), P_FLOAT (pr, 1));
}
static void
bi_expf (progs_t *pr)
{
R_FLOAT (pr) = expf (P_FLOAT (pr, 0));
}
static void
bi_logf (progs_t *pr)
{
@ -228,6 +234,12 @@ bi_atan2 (progs_t *pr)
R_DOUBLE (pr) = atan2 (P_DOUBLE (pr, 0), P_DOUBLE (pr, 1));
}
static void
bi_exp (progs_t *pr)
{
R_DOUBLE (pr) = exp (P_DOUBLE (pr, 0));
}
static void
bi_log (progs_t *pr)
{
@ -317,6 +329,7 @@ static builtin_t builtins[] = {
{"acos|f", bi_acosf, -1},
{"atan|f", bi_atanf, -1},
{"atan2|ff",bi_atan2f, -1},
{"exp|f", bi_expf, -1},
{"log|f", bi_logf, -1},
{"log2|f", bi_log2f, -1},
{"log10|f", bi_log10f, -1},
@ -340,6 +353,7 @@ static builtin_t builtins[] = {
{"acos|d", bi_acos, -1},
{"atan|d", bi_atan, -1},
{"atan2|dd",bi_atan2, -1},
{"exp|d", bi_exp, -1},
{"log|d", bi_log, -1},
{"log2|d", bi_log2, -1},
{"log10|d", bi_log10, -1},

View file

@ -78,6 +78,12 @@
///\name Exponentials and Logarithms
//\{
/**
Returns e to the power of \a x.
*/
@extern @overload float exp (float x);
@extern @overload double exp (double x);
/**
Returns the natural log of \a x.
*/

View file

@ -21,6 +21,7 @@ float (float x) asin = #0;
float (float x) acos = #0;
float (float x) atan = #0;
float (float y, float x) atan2 = #0;
float (float x) exp = #0;
float (float x) log = #0;
float (float x) log2 = #0;
float (float x) log10 = #0;
@ -45,6 +46,7 @@ double (double x) asin = #0;
double (double x) acos = #0;
double (double x) atan = #0;
double (double y, double x) atan2 = #0;
double (double x) exp = #0;
double (double x) log = #0;
double (double x) log2 = #0;
double (double x) log10 = #0;