mirror of
https://github.com/wagesj45/cs-mic.git
synced 2025-04-27 14:42:54 -05:00
49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace csmic.CodedFunctions
|
|
{
|
|
/// <summary>
|
|
/// A coded implementation of the sine function.
|
|
/// </summary>
|
|
class CF_Sin : ICodedFunction
|
|
{
|
|
#region ICodedFunction Members
|
|
|
|
/// <summary>
|
|
/// Expects 1 argument.
|
|
/// </summary>
|
|
public int NumExpectedArguments
|
|
{
|
|
get { return 1; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// The name of the function.
|
|
/// </summary>
|
|
public string FunctionName
|
|
{
|
|
get { return "sin"; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Executes a code block.
|
|
/// </summary>
|
|
/// <param name="args">The arguments used in the code block.</param>
|
|
/// <returns>The sine of the argument.</returns>
|
|
public decimal Execute(params decimal[] args)
|
|
{
|
|
decimal output = 0;
|
|
if (args.Length == this.NumExpectedArguments)
|
|
{
|
|
decimal input = args[0];
|
|
output = (decimal)Math.Sin((double)input);
|
|
}
|
|
return output;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|