safer numerical integration