Clean up some math functions to use the ISO C++ headers and namespace, simplying cross-platform support