I have settled on hoisting the GCD and XGCD preconditions (#9) via the Trusted Input :tm: pattern to enable recovery. As an example, the XGCD algorithms should extend all unsigned integers and they only fail when the arguments are infinite. I cannot limit these algorithms to a finite integer types because that makes them unavailable to InfiniInt\<T>. So, instead, I'll just require that the inputs are of the Finite\<T> type:
I have settled on hoisting the GCD and XGCD preconditions (#9) via the Trusted Input :tm: pattern to enable recovery. As an example, the XGCD algorithms should extend all unsigned integers and they only fail when the arguments are infinite. I cannot limit these algorithms to a finite integer types because that makes them unavailable to InfiniInt\<T>. So, instead, I'll just require that the inputs are of the Finite\<T> type:
Some convenience methods can then be written as finite integer extensions:
The current use case does not need Natural\<T> but I imagine that it is of similar importance.