Portable numerical algorithms in C#