import math


def calc_spec_smh(T, specs):
    """Calculate standard-state entropies minus enthalpies for all species.

    Parameters
    ----------
    T : float
        Temperature of gas mixture.
    specs : list of SpecInfo
        List of species.

    Returns
    -------
    spec_smh : list of float
        List of species' standard-state entropies minus enthalpies.
    """

    spec_smh = []

    Tlog = math.log(T)
    T2 = T * T
    T3 = T2 * T
    T4 = T3 * T

    Thalf = T / 2.0
    T2 = T2 / 6.0
    T3 = T3 / 12.0
    T4 = T4 / 20.0

    for sp in specs:
        if T <= sp.Trange[1]:
            smh = (sp.lo[0] * (Tlog - 1.0) + sp.lo[1] * Thalf + sp.lo[2] *
                   T2 + sp.lo[3] * T3 + sp.lo[4] * T4 - (sp.lo[5] / T) +
                   sp.lo[6]
                   )
        else:
            smh = (sp.hi[0] * (Tlog - 1.0) + sp.hi[1] * Thalf + sp.hi[2] *
                   T2 + sp.hi[3] * T3 + sp.hi[4] * T4 - (sp.hi[5] / T) +
                   sp.hi[6]
                   )

        spec_smh.append(smh)

    return (spec_smh)