Camera Information System
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.

24 lines
800 B

using EC.Helper.RabbitFunc.Expressions;
using EC.Helper.RabbitFunc.Runtime;
namespace EC.Helper.RabbitFunc.Extern;
[ExternLambda]
internal class LogLambdaExpression : SystemLambdaExpression
{
public LogLambdaExpression()
: base(typeof(Math).GetMethod(nameof(Math.Log), new Type[] { typeof(double), typeof(double) }), "log", new BodyExpression(),
Expression.Parameter(typeof(double), "x"),
Expression.Parameter(typeof(double), "e"))
{ }
private class BodyExpression : Expression
{
public override object Eval(RuntimeContext context)
{
var x = ParameterExpression.Access<double>(context, "x");
var e = ParameterExpression.Access<double>(context, "e");
return Math.Log(x, e);
}
}
}