It’s easy to add a fallback that calls lgamma (Need to use lgamma Instead of gamma to avoid overflow)
lgamma
gamma