Calculation of the critical overdensity in the spherical-collapse
  approximation
  Critical overdensity $\delta_c$ is a key concept in estimating the number
count of halos for different redshift and halo-mass bins, and therefore, it is
a powerful tool to compare cosmological models to observations. There are
currently two different prescriptions in the literature for its calculation,
namely, the differential-radius and the constant-infinity methods. In this work
we show that the latter yields precise results {\it only} if we are careful in
the definition of the so-called numerical infinities. Although the subtleties
we point out are crucial ingredients for an accurate determination of
$\delta_c$ both in general relativity and in any other gravity theory, we focus
on $f(R)$ modified-gravity models in the metric approach; in particular, we use
the so-called large ($F=1/3$) and small-field ($F=0$) limits. For both of them,
we calculate the relative errors (between our method and the others) in the
critical density $\delta_c$, in the comoving number density of halos per
logarithmic mass interval $n_{\ln M}$ and in the number of clusters at a given
redshift in a given mass bin $N_{\rm bin}$, as functions of the redshift. We
have also derived an analytical expression for the density contrast in the
linear regime as a function of the collapse redshift $z_c$ and $\Omega_{m0}$
for any $F$.
