changed tgamma/tgamma to exp(lmgamma - lmgamma) to reduce overflow in falling factorial and rising factorial