added versions for arbitrary multiprecision arithmetic