protected internal override void InitPrototypeId(int id)
{
if (id <= LAST_METHOD_ID)
{
string name;
int arity;
switch (id)
{
case Id_toSource:
{
arity = 0;
name = "toSource";
break;
}
case Id_abs:
{
arity = 1;
name = "abs";
break;
}
case Id_acos:
{
arity = 1;
name = "acos";
break;
}
case Id_asin:
{
arity = 1;
name = "asin";
break;
}
case Id_atan:
{
arity = 1;
name = "atan";
break;
}
case Id_atan2:
{
arity = 2;
name = "atan2";
break;
}
case Id_ceil:
{
arity = 1;
name = "ceil";
break;
}
case Id_cos:
{
arity = 1;
name = "cos";
break;
}
case Id_exp:
{
arity = 1;
name = "exp";
break;
}
case Id_floor:
{
arity = 1;
name = "floor";
break;
}
case Id_log:
{
arity = 1;
name = "log";
break;
}
case Id_max:
{
arity = 2;
name = "max";
break;
}
case Id_min:
{
arity = 2;
name = "min";
break;
}
case Id_pow:
{
arity = 2;
name = "pow";
break;
}
case Id_random:
{
arity = 0;
name = "random";
break;
}
case Id_round:
{
arity = 1;
name = "round";
break;
}
case Id_sin:
{
arity = 1;
name = "sin";
break;
}
case Id_sqrt:
{
arity = 1;
name = "sqrt";
break;
}
case Id_tan:
{
arity = 1;
name = "tan";
break;
}
default:
{
throw new InvalidOperationException(id.ToString());
}
}
InitPrototypeMethod(MATH_TAG, id, name, arity);
}
else
{
string name;
double x;
switch (id)
{
case Id_E:
{
x = Math.E;
name = "E";
break;
}
case Id_PI:
{
x = Math.PI;
name = "PI";
break;
}
case Id_LN10:
{
x = 2.302585092994046;
name = "LN10";
break;
}
case Id_LN2:
{
x = 0.6931471805599453;
name = "LN2";
break;
}
case Id_LOG2E:
{
x = 1.4426950408889634;
name = "LOG2E";
break;
}
case Id_LOG10E:
{
x = 0.4342944819032518;
name = "LOG10E";
break;
}
case Id_SQRT1_2:
{
x = 0.7071067811865476;
name = "SQRT1_2";
break;
}
case Id_SQRT2:
{
x = 1.4142135623730951;
name = "SQRT2";
break;
}
default:
{
throw new InvalidOperationException(id.ToString());
}
}
InitPrototypeValue(id, name, ScriptRuntime.WrapNumber(x), DONTENUM | READONLY | PERMANENT);
}
}