33 f64 base = args[0].asFloat();
34 f64 expv = args[1].asFloat();
43 return std::abs(args[0].asInt());
44 return std::abs(args[0].asFloat());
51 return std::floor(args[0].asFloat());
58 return std::ceil(args[0].asFloat());
65 return std::round(args[0].asFloat());
71 const Value &a = args[0];
72 const Value &b = args[1];
91 const Value &a = args[0];
92 const Value &b = args[1];
97 return Value(ai > bi ? ai : bi);
103 return Value(af > bf ? af : bf);
105 return a > b ? a : b;
111 return asm_log(args[0].asFloat());
117 return asm_exp(args[0].asFloat());
123 return asm_sin(args[0].asFloat());
129 return asm_cos(args[0].asFloat());
135 return asm_tan(args[0].asFloat());
double asm_tan(double a)
Native tangent.
double asm_log(double a)
Native natural logarithm.
double asm_sqrt(double a)
Native square root.
double asm_sin(double a)
Native sine.
double asm_exp(double a)
Native exponential.
double asm_cos(double a)
Native cosine.
double asm_pow(double a, double b)
Native power.
static Value math_max(const std::vector< Value > &args, VM *vm)
Maximum.
static f64 math_exp(const std::vector< Value > &args, VM *vm)
Exponential.
static f64 math_cos(const std::vector< Value > &args, VM *vm)
Cosine.
static f64 math_sin(const std::vector< Value > &args, VM *vm)
Sine.
static f64 math_log(const std::vector< Value > &args, VM *vm)
Natural logarithm.
static f64 math_sqrt(const std::vector< Value > &args, VM *vm)
Square root.
static f64 math_pow(const std::vector< Value > &args, VM *vm)
Power.
static void checkArgCount(const std::vector< Value > &args, size_t minimumArguments, const std::string &name, bool allowMoreArguments=false)
static void registerMathFunctions(VM *vm)
static f64 math_round(const std::vector< Value > &args, VM *vm)
Round.
static Value math_abs(const std::vector< Value > &args, VM *vm)
Absolute value.
static f64 math_tan(const std::vector< Value > &args, VM *vm)
Tangent.
static f64 math_ceil(const std::vector< Value > &args, VM *vm)
Ceiling.
static f64 math_floor(const std::vector< Value > &args, VM *vm)
Floor.
static Value math_min(const std::vector< Value > &args, VM *vm)
Minimum.
void registerNativeFunction(const std::string &name, NativeFunction fn)
Register a native function.
A value in the Phasor VM.
bool isInt() const noexcept
f64 asFloat() const noexcept
Get the value as a f64.
i64 asInt() const noexcept
Get the value as an integer.
bool isNumber() const noexcept
int64_t asm_iless_than(int64_t a, int64_t b)
Native Less than comparison.
int64_t asm_flless_than(double a, double b)
The Phasor Programming Language and Runtime.