C# math utilities