Math utilities for C#