Use the lgamma function. > log(gamma(170)) [1] 701.4373 > lgamma(170) [1] 701.4373 > In typical uses of gamma(), they are multiplied or divided by other gamma() values, bringing the final result into the range of double precision numbers. Also, look at beta(), which does those divisions of gamma() for you.