Proper use of the Integer Protocols

I had a question about the semantic requirements of the numeric protocols: Would it be correct to conform a signed type that always produces a non-negative remainder to BinaryInteger?

No; the semantics of % do not allow that. Extension methods implemented for integer protocols would behave in unexpected ways if your type does not conform to the required semantics.

1 Like