mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Add remaining VM-supported floating point operations to DECORATE
- These are: * exp * log * log10 * ceil * floor * acos * asin * atan * tan * cosh * sinh * tanh
This commit is contained in:
parent
8ee820042f
commit
a862f728b6
2 changed files with 24 additions and 2 deletions
|
@ -284,8 +284,18 @@ xx(FRandom)
|
|||
xx(Random2)
|
||||
xx(RandomPick)
|
||||
xx(FRandomPick)
|
||||
xx(Exp)
|
||||
xx(Log10)
|
||||
xx(Ceil)
|
||||
xx(ACos)
|
||||
xx(ASin)
|
||||
xx(ATan)
|
||||
xx(Cos)
|
||||
xx(Sin)
|
||||
xx(Tan)
|
||||
xx(CosH)
|
||||
xx(SinH)
|
||||
xx(TanH)
|
||||
xx(Alpha)
|
||||
xx(Angle)
|
||||
xx(Args)
|
||||
|
|
|
@ -65,9 +65,23 @@ struct FLOP
|
|||
// degrees to radians for those that work with angles.
|
||||
static const FLOP FxFlops[] =
|
||||
{
|
||||
{ NAME_Exp, FLOP_EXP, [](double v) { return exp(v); } },
|
||||
{ NAME_Log, FLOP_LOG, [](double v) { return log(v); } },
|
||||
{ NAME_Log10, FLOP_LOG10, [](double v) { return log10(v); } },
|
||||
{ NAME_Sqrt, FLOP_SQRT, [](double v) { return sqrt(v); } },
|
||||
{ NAME_Ceil, FLOP_CEIL, [](double v) { return ceil(v); } },
|
||||
{ NAME_Floor, FLOP_FLOOR, [](double v) { return floor(v); } },
|
||||
|
||||
{ NAME_ACos, FLOP_ACOS_DEG, [](double v) { return acos(v) * (180.0 / M_PI); } },
|
||||
{ NAME_ASin, FLOP_ASIN_DEG, [](double v) { return asin(v) * (180.0 / M_PI); } },
|
||||
{ NAME_ATan, FLOP_ATAN_DEG, [](double v) { return atan(v) * (180.0 / M_PI); } },
|
||||
{ NAME_Cos, FLOP_COS_DEG, [](double v) { return cos(v * (M_PI / 180.0)); } },
|
||||
{ NAME_Sin, FLOP_SIN_DEG, [](double v) { return sin(v * (M_PI / 180.0)); } },
|
||||
{ NAME_Tan, FLOP_TAN_DEG, [](double v) { return tan(v * (M_PI / 180.0)); } },
|
||||
|
||||
{ NAME_CosH, FLOP_COSH, [](double v) { return cosh(v); } },
|
||||
{ NAME_SinH, FLOP_SINH, [](double v) { return sinh(v); } },
|
||||
{ NAME_TanH, FLOP_TANH, [](double v) { return tanh(v); } },
|
||||
};
|
||||
|
||||
ExpEmit::ExpEmit(VMFunctionBuilder *build, int type)
|
||||
|
@ -3162,8 +3176,6 @@ FxFunctionCall::~FxFunctionCall()
|
|||
|
||||
FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
||||
{
|
||||
// There's currently only 3 global functions.
|
||||
// If this changes later, it won't be here!
|
||||
for (int i = 0; i < countof(FxFlops); ++i)
|
||||
{
|
||||
if (MethodName == FxFlops[i].Name)
|
||||
|
|
Loading…
Reference in a new issue