<div dir="ltr">Hi all,<div><br></div><div>A few weeks ago, Joe Groff challenged users on Twitter to create a Rational&lt;T&gt; type making use of the new integer protocols implemented for Swift 4. As it happens, I&#39;d already started a project to try out these new number protocols. Now that I think the most embarrassing bugs have been squashed in that project, I thought I&#39;d share it here in case anyone else might find it useful.</div><div><br></div><div>NumericAnnex &lt;<a href="https://github.com/xwu/NumericAnnex">https://github.com/xwu/NumericAnnex</a>&gt; is meant to supplement the standard library&#39;s numerics facilities in Swift 4. At the moment, it provides:</div><div><br></div><div>* Extensions to BinaryInteger for GCD, LCM, and exponentiation</div><div><br></div><div>* Protocols Math (refines SignedNumeric), Real (refines Math and FloatingPoint), and PRNG  (refines Sequence and IteratorProtocol)</div><div><br></div><div>* Types Complex&lt;T&gt;, Rational&lt;T&gt;, and Random</div><div><br></div><div>Documentation is available at &lt;<a href="https://xwu.github.io/NumericAnnex/">https://xwu.github.io/NumericAnnex/</a>&gt;.</div><div><br></div><div>I&#39;d love to hear feedback. I&#39;ll follow up shortly on Swift Evolution with some thoughts on future improvements to integer protocols based on this experience.</div><div><br></div></div>