Numerical solution of the phase-field equation with minimized discretization error