  Roundoff error problems have occurred frequently in interpolation methods of
time-fractional equations, which can lead to undesirable results such as the
failure of optimal convergence. These problems are essentially caused by
catastrophic cancellations. Currently, a feasible way to avoid these
cancellations is using the Gauss--Kronrod quadrature to approximate the
integral formulas of coefficients rather than computing the explicit formulas
directly for example in the L2-type methods. This nevertheless increases
computational cost and arises additional integration errors. In this work, a
new framework to handle catastrophic cancellations is proposed, in particular,
in the computation of the coefficients for standard and fast L2-type methods on
general nonuniform meshes. We propose a concept of $\delta$-cancellation and
then some threshold conditions ensuring that $\delta$-cancellations will not
happen. If the threshold conditions are not satisfied, a Taylor-expansion
technique is proposed to avoid $\delta$-cancellation. Numerical experiments
show that our proposed method performs as accurate as the Gauss--Kronrod
quadrature method and meanwhile much more efficient. This enables us to
complete long time simulations with hundreds of thousands of time steps in
short time.
