Rob Browning writes: > > There may well be bugs A small one in (gcd n 0), test and possible fix below. The result should of course be abs(n) but mpz_gcd_ui can't return that if it doesn't fit a ulong. > where > special casing with GMP operations could help, but it'll probably take > some good benchmarking to know for sure. ash (mentioned in the comments) would definitely benefit from the mpz 2exp functions. In gcd, it'd be nice for the inum/bignum case to share code with the bignum/inum case, like lcm does.