Define Pi constant, if not defined yet. Works around various build issues on Windows
std::isnan() exists only from c++11 onwards.