32 double base = args[0].asFloat();
33 double expv = args[1].asFloat();
42 return std::abs(args[0].asInt());
43 return std::abs(args[0].asFloat());
50 return static_cast<int64_t
>(std::floor(args[0].asFloat()));
57 return static_cast<int64_t
>(std::ceil(args[0].asFloat()));
64 return static_cast<int64_t
>(std::round(args[0].asFloat()));
70 const Value &a = args[0];
71 const Value &b = args[1];
74 int64_t ai = a.
asInt();
75 int64_t bi = b.
asInt();
90 const Value &a = args[0];
91 const Value &b = args[1];
94 int64_t ai = a.
asInt();
95 int64_t bi = b.
asInt();
96 return Value(ai > bi ? ai : bi);
102 return Value(af > bf ? af : bf);
104 return a > b ? a : b;
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_sin(const std::vector< Value > &args, VM *vm)
Sine.
static Value math_max(const std::vector< Value > &args, VM *vm)
Maximum.
static Value math_floor(const std::vector< Value > &args, VM *vm)
Floor.
static Value math_ceil(const std::vector< Value > &args, VM *vm)
Ceiling.
static Value math_round(const std::vector< Value > &args, VM *vm)
Round.
static void checkArgCount(const std::vector< Value > &args, size_t minimumArguments, const std::string &name, bool allowMoreArguments=false)
static void registerMathFunctions(VM *vm)
static Value math_pow(const std::vector< Value > &args, VM *vm)
Power.
static Value math_tan(const std::vector< Value > &args, VM *vm)
Tangent.
static Value math_log(const std::vector< Value > &args, VM *vm)
Natural logarithm.
static Value math_exp(const std::vector< Value > &args, VM *vm)
Exponential.
static Value math_cos(const std::vector< Value > &args, VM *vm)
Cosine.
static Value math_abs(const std::vector< Value > &args, VM *vm)
Absolute value.
static Value math_sqrt(const std::vector< Value > &args, VM *vm)
Square root.
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.
double asFloat() const
Get the value as a double.
bool isNumber() const
Check if the value is a number.
int64_t asInt() const
Get the value as an integer.
bool isInt() const
Check if the value is an integer.
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.