Piecewise polynomial Lyapunov functions with guaranteed accuracy