General purpose math utilities designed for performance