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