gammaln implementation and test replacing calls to extern libs