Error inequalities for a quadrature formula and applications