Adding functions to Standard Library
This commit is contained in:
parent
808d4ca420
commit
4a21ff3d46
39 changed files with 1465 additions and 51 deletions
36
src/StandardLibrary/Functions/Trigonometry/Atan2.cs
Normal file
36
src/StandardLibrary/Functions/Trigonometry/Atan2.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry
|
||||
{
|
||||
public class Atan2 : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "atan2";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new FunctionArgument("value", FunctionValue.NUMBER);
|
||||
yield return new FunctionArgument("value", FunctionValue.NUMBER);
|
||||
}
|
||||
}
|
||||
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
{
|
||||
var inputFirst = _args[0].Value;
|
||||
decimal valueFirst = Convert.ToDecimal(inputFirst.Value);
|
||||
var inputSecond = _args[1].Value;
|
||||
decimal valueSecond = Convert.ToDecimal(inputSecond.Value);
|
||||
|
||||
return new FunctionValue(FunctionValueType.Numeric, Math.Atan2((double)valueFirst, (double)valueSecond));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue