def eval_poly(coeff,x):
    """
    Evaluate polynomial represented as integer coefficients at x in linear time.

    Test f(x)=4x^3+3x^2+2x+1, f(1)=10
    >>> abs(eval_poly([1,2,3,4],1.0)-10) < 1e-7
    True

    Test f(x)=4x^3+2x, f(2)=36
    >>> abs(eval_poly([0,2,0,4],2.0)-36) < 1e-7
    True
    """
    sum = coeff[-1]
    for a in reversed(coeff[:-1]):
        sum = sum*x+a
    return sum