  Very-high-energy gamma rays produce electron positron pairs in interactions
with low-energy photons of extragalactic background light during propagation
through the intergalactic medium. The electron-positron pairs generate
secondary gamma rays detectable by gamma-ray telescopes. This secondary
emission can be used to detect intergalactic magnetic fields (IGMF) in the
voids of large-scale structure. A new gamma-ray observatory, namely, Cherenkov
Telescope Array (CTA), will provide an increase in sensitivity for detections
of these secondary gamma-ray emission and enable the measurement of its
properties for sources at cosmological distances. The interpretation of the CTA
data, including detection of IGMF and study of its properties and origins, will
require precision modeling of the primary and secondary gamma-ray fluxes. We
asses the precision of the modeling of the secondary gamma-ray emission using
model calculations with publicly available Monte-Carlo codes CRPropa and ELMAG
and compare their predictions with theoretical expectations and with model
calculations of a newly developed CRbeam code. We find that model predictions
of different codes differ by up to 50% for low-redshift sources, with
discrepancies increasing up to order-of-magnitude level with the increasing
source redshifts. We identify the origin of these discrepancies and demonstrate
that after eliminating the inaccuracies found, the discrepancies between the
three codes are reduced to 10% when modeling nearby sources with z~0.1. We
argue that the new CRbeam code provides reliable predictions for spectral,
timing and imaging properties of the secondary gamma-ray signal for both nearby
and distant sources with z~1. Thus, it can be used to study gamma-ray sources
and IGMF with a level of precision that is appropriate for the prospective CTA
study of the effects of gamma-ray propagation through the intergalactic medium.
