33 lines
843 B
C#
33 lines
843 B
C#
namespace CSMic.StandardLibrary.Functions.Rounding
|
|
{
|
|
public class Fractional : FunctionBase, ICodedFunction
|
|
{
|
|
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return "frac";
|
|
}
|
|
}
|
|
|
|
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, value - Math.Truncate(value));
|
|
});
|
|
}
|
|
}
|
|
}
|