A straight port of JustMath.js to C#