  Future galaxy surveys require one percent precision in the theoretical
knowledge of the power spectrum over a large range including very nonlinear
scales. While this level of accuracy is easily obtained in the linear regime
with perturbation theory, it represents a serious challenge for small scales
where numerical simulations are required. In this paper we quantify the
precision of present-day $N$-body methods, identifying main potential error
sources from the set-up of initial conditions to the measurement of the final
power spectrum. We directly compare three widely used $N$-body codes, Ramses,
Pkdgrav3, and Gadget3 which represent three main discretisation techniques: the
particle-mesh method, the tree method, and a hybrid combination of the two. For
standard run parameters, the codes agree to within one percent at $k\leq1$
$h\,\rm Mpc^{-1}$ and to within three percent at $k\leq10$ $h\,\rm Mpc^{-1}$.
We also consider the bispectrum and show that the reduced bispectra agree at
the sub-percent level for $k\leq 2$ $h\,\rm Mpc^{-1}$. In a second step, we
quantify potential errors due to initial conditions, box size, and resolution
using an extended suite of simulations performed with our fastest code
Pkdgrav3. We demonstrate that the simulation box size should not be smaller
than $L=0.5$ $h^{-1}\rm Gpc$ to avoid systematic finite-volume effects (while
much larger boxes are required to beat down the statistical sample variance).
Furthermore, a maximum particle mass of $M_{\rm p}=10^{9}$ $h^{-1}\rm
M_{\odot}$ is required to conservatively obtain one percent precision of the
matter power spectrum. As a consequence, numerical simulations covering large
survey volumes of upcoming missions such as DES, LSST, and Euclid will need
more than a trillion particles to reproduce clustering properties at the
targeted accuracy.
