Add XML doc comments
This commit is contained in:
parent
b911ccfbfe
commit
80c2674070
37 changed files with 863 additions and 0 deletions
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Angle
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>degrees</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>degrees</c> function evaluates a numeric expression in radians and returns the equivalent angle in degrees.
|
||||
/// </remarks>
|
||||
public class Degrees : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>degrees</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>degrees</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>degrees</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the input angle converted to degrees.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Angle
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>radians</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>radians</c> function evaluates a numeric expression in degrees and returns the equivalent angle in radians.
|
||||
/// </remarks>
|
||||
public class Radians : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>radians</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>radians</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>radians</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the input angle converted to radians.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,17 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Angle
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>wrapangle</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>wrapangle</c> function evaluates a numeric value and wraps it into the requested period.
|
||||
/// </remarks>
|
||||
public class WrapAngle : FunctionBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>wrapangle</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -10,6 +20,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>wrapangle</c> function.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Three numeric arguments named <c>value</c>, <c>periodStart</c>, and <c>periodEnd</c>.
|
||||
/// </value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -20,6 +36,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>wrapangle</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly three numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the wrapped value within the supplied period.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.NumberTheory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>ncr</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>ncr</c> function evaluates two non-negative integers and returns the number of combinations.
|
||||
/// </remarks>
|
||||
public class BinomialCoefficient : FunctionBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>ncr</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -17,6 +27,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>ncr</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>first</c> and <c>second</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -26,6 +40,15 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>ncr</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the number of combinations for the supplied values.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,13 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.NumberTheory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>fac</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>fac</c> function evaluates a numeric expression and returns its factorial when the value is an integer,
|
||||
/// or its gamma-based extension when the value is non-integer.
|
||||
/// </remarks>
|
||||
public class Factorial : FunctionBase, ICodedFunction
|
||||
{
|
||||
private static readonly double[] LANCZOS_APPROXIMATION =
|
||||
|
|
@ -22,6 +29,9 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
1.5056327351493116e-7
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the lookup table used for exact factorial values from <c>0</c> through <c>20</c>.
|
||||
/// </summary>
|
||||
public static readonly decimal[] INTEGER_FACTORIAL_LOOKUP =
|
||||
{
|
||||
/* 0 */ 1,
|
||||
|
|
@ -47,6 +57,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
/* 20 */ 2432902008176640000
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>fac</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -55,6 +69,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>fac</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -63,6 +81,15 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>fac</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the factorial result or a gamma-based approximation.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
@ -92,6 +119,11 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the gamma function used to extend factorial values to non-integer inputs.
|
||||
/// </summary>
|
||||
/// <param name="shiftedGama">The shifted input value.</param>
|
||||
/// <returns>The gamma of the supplied value.</returns>
|
||||
private static double Gamma(double shiftedGama)
|
||||
{
|
||||
if (shiftedGama < 0.5)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.NumberTheory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>gcd</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>gcd</c> function evaluates two positive integers and returns their greatest common divisor.
|
||||
/// </remarks>
|
||||
public class GreatestCommonDivisor : FunctionBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>gcd</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -17,6 +27,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>gcd</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>first</c> and <c>second</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -26,6 +40,15 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>gcd</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the greatest common divisor of the two input values.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
@ -51,6 +74,12 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the greatest common divisor using the Euclidean algorithm.
|
||||
/// </summary>
|
||||
/// <param name="first">The first value.</param>
|
||||
/// <param name="second">The second value.</param>
|
||||
/// <returns>The greatest common divisor of the supplied values.</returns>
|
||||
public decimal EuclideanAlgorithm(decimal first, decimal second)
|
||||
{
|
||||
if(second == 0)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.NumberTheory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>lcm</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>lcm</c> function evaluates two positive integers and returns their least common multiple.
|
||||
/// </remarks>
|
||||
public class LeastCommonMultiple : FunctionBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>lcm</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -17,6 +27,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>lcm</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>first</c> and <c>second</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -26,6 +40,15 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>lcm</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the least common multiple of the two input values.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
@ -52,6 +75,12 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the greatest common divisor used when deriving the least common multiple.
|
||||
/// </summary>
|
||||
/// <param name="first">The first value.</param>
|
||||
/// <param name="second">The second value.</param>
|
||||
/// <returns>The greatest common divisor of the supplied values.</returns>
|
||||
public decimal EuclideanAlgorithm(decimal first, decimal second)
|
||||
{
|
||||
if(second == 0)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.NumberTheory
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>npr</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>npr</c> function evaluates two non-negative integers and returns the number of permutations.
|
||||
/// </remarks>
|
||||
public class Permutations : FunctionBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>npr</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -17,6 +27,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>npr</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>first</c> and <c>second</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -26,6 +40,15 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>npr</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the number of permutations for the supplied values.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,18 @@ using CSMic.StandardLibrary.Functions.Random;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.Random
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>bern</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>bern</c> function evaluates a probability and returns a boolean result using a Bernoulli trial.
|
||||
/// </remarks>
|
||||
public class Bernoulli : RandomBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>bern</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -13,6 +23,10 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>bern</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>p</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -21,6 +35,15 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>bern</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A boolean <see cref="FunctionValue"/> containing <c>true</c> when the Bernoulli trial succeeds; otherwise <c>false</c>.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,18 @@ using CSMic.StandardLibrary.Functions.Random;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.Random
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>flip</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>flip</c> function returns a fair boolean result from a 50/50 random trial.
|
||||
/// </remarks>
|
||||
public class FairFlip : RandomBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>flip</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -13,6 +23,10 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>flip</c> function.
|
||||
/// </summary>
|
||||
/// <value>This function takes no arguments.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -21,6 +35,15 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>flip</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. No arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A boolean <see cref="FunctionValue"/> containing <c>true</c> or <c>false</c> with equal probability.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -6,19 +6,31 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.Random
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides shared random-number helpers for the standard-library random functions.
|
||||
/// </summary>
|
||||
public abstract class RandomBase : FunctionBase
|
||||
{
|
||||
// Provide a thread-local random to approximate Random.Shared in .NET Standard
|
||||
private static readonly System.Threading.ThreadLocal<System.Random> s_threadLocalRandom =
|
||||
new System.Threading.ThreadLocal<System.Random>(() => new System.Random());
|
||||
|
||||
/// <summary>
|
||||
/// Gets the thread-local random number generator used by the random functions.
|
||||
/// </summary>
|
||||
protected static System.Random RandomNumberGenerator => s_threadLocalRandom.Value!;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a pseudo-random decimal in the half-open interval [0, 1).
|
||||
/// </summary>
|
||||
protected static decimal NextDecimal()
|
||||
{
|
||||
return Convert.ToDecimal(RandomNumberGenerator.NextDouble());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a pseudo-random decimal sampled from a normal distribution centered at zero.
|
||||
/// </summary>
|
||||
protected static decimal NextDecimalNormal()
|
||||
{
|
||||
double u1 = 1.0 - RandomNumberGenerator.NextDouble();
|
||||
|
|
|
|||
|
|
@ -3,8 +3,18 @@ using CSMic.StandardLibrary.Functions.Random;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.Random
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>randn</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>randn</c> function returns a pseudo-random decimal sampled from a normal distribution.
|
||||
/// </remarks>
|
||||
public class RandomNormal : RandomBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>randn</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -13,6 +23,10 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>randn</c> function.
|
||||
/// </summary>
|
||||
/// <value>This function takes no arguments.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -21,6 +35,15 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>randn</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. No arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing a pseudo-random decimal sampled from a normal distribution.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,18 @@ using CSMic.StandardLibrary.Functions.Random;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.Random
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>randns</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>randns</c> function evaluates two numeric bounds and returns a pseudo-random decimal derived from a normal distribution.
|
||||
/// </remarks>
|
||||
public class RandomNormalSpread : RandomBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>randns</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -13,6 +23,10 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>randns</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>lower</c> and <c>upper</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -22,6 +36,15 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>randns</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing a pseudo-random decimal derived from a normal distribution.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,18 @@ using CSMic.StandardLibrary.Functions.Random;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.Random
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>rand</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>rand</c> function returns a uniformly distributed pseudo-random decimal.
|
||||
/// </remarks>
|
||||
public class RandomUniform : RandomBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>rand</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -13,6 +23,10 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>rand</c> function.
|
||||
/// </summary>
|
||||
/// <value>This function takes no arguments.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -21,6 +35,15 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>rand</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. No arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing a pseudo-random decimal in the half-open interval [0, 1).
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,18 @@ using CSMic.StandardLibrary.Functions.Random;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions.Random
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>rands</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>rands</c> function evaluates two numeric bounds and returns a uniformly distributed pseudo-random decimal between them.
|
||||
/// </remarks>
|
||||
public class RandomUniformSpread : RandomBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>rands</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -13,6 +23,10 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>rands</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>lower</c> and <c>upper</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -22,6 +36,15 @@ namespace CSMic.StandardLibrary.Functions.Random
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>rands</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing a uniformly distributed pseudo-random decimal between the supplied bounds.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Rounding
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>ceiling</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>ceiling</c> function evaluates a numeric value and rounds it toward positive infinity.
|
||||
/// </remarks>
|
||||
public class Ceiling : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>ceiling</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>ceiling</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>ceiling</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the smallest integer greater than or equal to the input.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Rounding
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>clamp</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>clamp</c> function evaluates a numeric value and limits it to the supplied bounds.
|
||||
/// </remarks>
|
||||
public class Clamp : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>clamp</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>clamp</c> function.
|
||||
/// </summary>
|
||||
/// <value>Three numeric arguments named <c>value</c>, <c>low</c>, and <c>high</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -21,6 +35,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>clamp</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly three numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the input value constrained to the supplied range.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Rounding
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>floor</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>floor</c> function evaluates a numeric value and rounds it toward negative infinity.
|
||||
/// </remarks>
|
||||
public class Floor : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>floor</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>floor</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>floor</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the largest integer less than or equal to the input.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Rounding
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>frac</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>frac</c> function evaluates a numeric value and returns its fractional component.
|
||||
/// </remarks>
|
||||
public class Fractional : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>frac</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>frac</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>frac</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the fractional component of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Rounding
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>round</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>round</c> function evaluates a numeric value and rounds it to the requested precision.
|
||||
/// </remarks>
|
||||
public class Round : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>round</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>round</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>value</c> and <c>precision</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -20,6 +34,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>round</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the input value rounded to the requested precision.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Rounding
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>truncate</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>truncate</c> function evaluates a numeric value and removes its fractional component.
|
||||
/// </remarks>
|
||||
public class Truncate : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>truncate</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>truncate</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>truncate</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the input value with the fractional component removed.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>acos</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>acos</c> function evaluates a numeric expression and returns its arccosine.
|
||||
/// </remarks>
|
||||
public class Acos : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>acos</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>acos</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>acos</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the arccosine of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>asin</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>asin</c> function evaluates a numeric expression and returns its arcsine.
|
||||
/// </remarks>
|
||||
public class Asin : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>asin</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>asin</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>asin</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the arcsine of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>atan</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>atan</c> function evaluates a numeric expression and returns its arctangent.
|
||||
/// </remarks>
|
||||
public class Atan : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>atan</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>atan</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>atan</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the arctangent of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>atan2</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>atan2</c> function evaluates two numeric expressions and returns the arctangent of their quotient.
|
||||
/// </remarks>
|
||||
public class Atan2 : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>atan2</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>atan2</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>y</c> and <c>x</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -20,6 +34,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>atan2</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the arctangent of the supplied coordinates.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>cos</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>cos</c> function evaluates a numeric expression and returns its cosine.
|
||||
/// </remarks>
|
||||
public class Cos : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>cos</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>cos</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>cos</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the cosine of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry.Hyperbolic
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>acosh</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>acosh</c> function evaluates a numeric expression and returns its inverse hyperbolic cosine.
|
||||
/// </remarks>
|
||||
public class Acosh : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>acosh</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>acosh</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>acosh</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the inverse hyperbolic cosine of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry.Hyperbolic
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>asinh</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>asinh</c> function evaluates a numeric expression and returns its inverse hyperbolic sine.
|
||||
/// </remarks>
|
||||
public class Asinh : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>asinh</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>asinh</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>asinh</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the inverse hyperbolic sine of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry.Hyperbolic
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>atanh</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>atanh</c> function evaluates a numeric expression and returns its inverse hyperbolic tangent.
|
||||
/// </remarks>
|
||||
public class Atanh : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>atanh</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>atanh</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>atanh</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the inverse hyperbolic tangent of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry.Hyperbolic
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>cosh</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>cosh</c> function evaluates a numeric expression and returns its hyperbolic cosine.
|
||||
/// </remarks>
|
||||
public class Cosh : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>cosh</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>cosh</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>cosh</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the hyperbolic cosine of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry.Hyperbolic
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>sinh</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>sinh</c> function evaluates a numeric expression and returns its hyperbolic sine.
|
||||
/// </remarks>
|
||||
public class Sinh : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>sinh</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>sinh</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>sinh</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the hyperbolic sine of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry.Hyperbolic
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>tanh</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>tanh</c> function evaluates a numeric expression and returns its hyperbolic tangent.
|
||||
/// </remarks>
|
||||
public class Tanh : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>tanh</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>tanh</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>tanh</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the hyperbolic tangent of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>sin</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>sin</c> function evaluates a numeric expression and returns its sine.
|
||||
/// </remarks>
|
||||
public class Sin : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>sin</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>sin</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>sin</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the sine of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
namespace CSMic.StandardLibrary.Functions.Trigonometry
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>tan</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>tan</c> function evaluates a numeric expression and returns its tangent.
|
||||
/// </remarks>
|
||||
public class Tan : FunctionBase, ICodedFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>tan</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -11,6 +21,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>tan</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -19,6 +33,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>tan</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the tangent of the input value.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,18 @@
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>abs</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>abs</c> function evaluates a numeric expression and returns its absolute value.
|
||||
/// </remarks>
|
||||
public class AbsoluteValue : FunctionBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>abs</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -12,6 +22,10 @@ namespace CSMic.StandardLibrary.Functions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>abs</c> function.
|
||||
/// </summary>
|
||||
/// <value>A single numeric argument named <c>value</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -20,6 +34,15 @@ namespace CSMic.StandardLibrary.Functions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>abs</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the absolute value of the input.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>max</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>max</c> function evaluates two numeric expressions and returns the larger value.
|
||||
/// </remarks>
|
||||
public class Max : FunctionBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>max</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -17,6 +27,10 @@ namespace CSMic.StandardLibrary.Functions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>max</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>first</c> and <c>second</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -26,6 +40,15 @@ namespace CSMic.StandardLibrary.Functions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>max</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the larger of the two input values.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CSMic.StandardLibrary.Functions
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the standard-library <c>min</c> function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>min</c> function evaluates two numeric expressions and returns the smaller value.
|
||||
/// </remarks>
|
||||
public class Min : FunctionBase, ICodedFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the expression-language name used to invoke this function.
|
||||
/// </summary>
|
||||
/// <value><c>min</c>.</value>
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
|
@ -17,6 +27,10 @@ namespace CSMic.StandardLibrary.Functions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument signature expected by the <c>min</c> function.
|
||||
/// </summary>
|
||||
/// <value>Two numeric arguments named <c>first</c> and <c>second</c>.</value>
|
||||
public override IEnumerable<FunctionArgument> ExpectedArguments
|
||||
{
|
||||
get
|
||||
|
|
@ -26,6 +40,15 @@ namespace CSMic.StandardLibrary.Functions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the <c>min</c> function.
|
||||
/// </summary>
|
||||
/// <param name="args">
|
||||
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A numeric <see cref="FunctionValue"/> containing the smaller of the two input values.
|
||||
/// </returns>
|
||||
public FunctionValue Execute(params FunctionArgument[] args)
|
||||
{
|
||||
return base.Execute(args, (_args) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue