def gamma_below(a, x):
    assert 0. < a               # XXX NaN?
    assert 0. <= x              # XXX NaN?
    if x == 0.:
        return 0.
    if x > max(1., a):
        return 1. - gamma_above(a, x)

    # m = exp [a log x - x - log Gamma(a)] = x^a e^-x / Gamma(a)
    w = a*math.log(x) - x - math.lgamma(a)
    if w < -MAXLOG:
        return 0.
    m = ieee_exp(w)

    def seq():
        k = 0
        t = 1.
        while True:
            yield t
            k += 1
            t *= x/(a + k)

    return (m/a)*abs_summation(seq())
Allocates a range of IDs of size for the model_key defined by model
dataset/ETHPy150Open probcomp/bayeslite/src/math_util.py/gamma_below--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/ext/db/__init__.py/allocate_ids