Context. Diagnostics based on the polarization properties of the synchrotron emission can provide precious information on both the ordered structure and the random level of the magnetic field. While this issue has already been analyzed in the radio band, the polarization data recently obtained by the mission IXPE have shown the need to extend this analysis to the X-ray band. Aims. While our immediate targets are young supernova remnants, the scope of this analysis is wider. Our aim is to extend the analysis to particle energy distributions more complex than a power law, and to investigate a wider range of cases involving a composition of ordered and random magnetic fields. Methods. Since an analytical approach is only possible in a limited number of cases, we devised for this purpose an optimized numerical scheme, and we directly used it to investigate particle energy distributions in the form of a power law with an exponential or super-exponential cutoff. We also considered a general combination of an ordered field plus an anisotropic random component. Results. We show that the previously derived analytic formulae, valid for power-law distributions, may also be good approximations of the polarization degree in the more general case with a cutoff, as typically seen in X-rays. We explicitly analyzed the young supernova remnants SN 1006, Tycho, and Cas A. In particular, for SN 1006 we proved the consistency between the radio and X-ray polarization degrees, favoring the case of a predominantly random field with an anisotropic distribution. In addition, for the power-law case we investigated the effect of a compression on ordered and on random magnetic field components, aimed at describing the mid-age radio supernova remnants. Conclusions. This work allows a more efficient exploitation of radio and X-ray measurements of the synchrotron polarization, and is addressed to present observations with IXPE and to future projects.