port most gamma function code to arb/acb