On the calculation of the frequency-dependent dielectric constant in computer simulations