replaced apparently non-standard M_PI with boost::math::double_constants::pi