namespace CSMic.StandardLibrary.Functions.Trigonometry { /// /// Represents the standard-library atan function. /// /// /// The atan function evaluates a numeric expression and returns its arctangent. /// public class Atan : FunctionBase, ICodedFunction { /// /// Gets the expression-language name used to invoke this function. /// /// atan. public string Name { get { return "atan"; } } /// /// Gets the argument signature expected by the atan function. /// /// A single numeric argument named value. public override IEnumerable ExpectedArguments { get { yield return new FunctionArgument("value", FunctionValue.NUMBER); } } /// /// Executes the atan function. /// /// /// The evaluated arguments supplied to the function. Exactly one numeric argument is expected. /// /// /// A numeric containing the arctangent of the input value. /// 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, Math.Atan((double)value)); }); } } }