CSharp · Console
using System;
using System.Collections.Generic;
using PaleyExpressions.Runners;
public class Program
{
public static void Main()
{
var variables = new Dictionary<string, object?>
{
{"a", 10d},
{"b", 3.98d},
{"c", 78.65d}
};
var runner = new ExpressionRunner("abs(((a << 3) + (b * 123.456) / (c % 19 + 1.5) - (a * b) % 7.3) + (((~(a & 0xFF)) | (0x7F << (a % 5))) & 65535)) * ((c / (a + b)) - ((a & 3) << 2)) / (1 + (b % 2.5))");
double result = 0d;
// run a million times - because, why not?
for(int i = 0; i < 1_000_000; i++)
{
result = (double)runner.Interpret(variables);
}
Console.WriteLine(result);
}
}