You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
641 B
21 lines
641 B
2 years ago
|
using EC.Helper.RabbitFunc.Expressions;
|
||
|
using EC.Helper.RabbitFunc.Runtime;
|
||
|
|
||
|
namespace EC.Helper.RabbitFunc.Extern;
|
||
|
|
||
|
[ExternLambda]
|
||
|
internal class FloorLambdaExpression : SystemLambdaExpression
|
||
|
{
|
||
|
public FloorLambdaExpression()
|
||
|
: base(typeof(Math).GetMethod(nameof(Math.Floor), new Type[] { typeof(double) }), "floor", new BodyExpression(),
|
||
|
Expression.Parameter(typeof(double), "x"))
|
||
|
{ }
|
||
|
|
||
|
private class BodyExpression : Expression
|
||
|
{
|
||
|
public override object Eval(RuntimeContext context)
|
||
|
{
|
||
|
return Math.Floor(ParameterExpression.Access<double>(context, "x"));
|
||
|
}
|
||
|
}
|
||
|
}
|