<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi Ben,</div><div class=""><br class=""></div><div class="">The reason to include init?&lt;T : BinaryInteger&gt;(exactly:T) as a requirement for the Arithmetic (now Number) protocol was that it already refines ExpressibleByIntegerLiteral, so it would be quite weird to *not* allow explicit initialization.</div><div class=""><br class=""></div><div class="">Generic conversion to floating point types is not covered by this proposal, but is somewhat related:</div><div class=""><a href="https://github.com/apple/swift/blob/master/stdlib/public/core/FloatingPoint.swift.gyb#L257" class="">https://github.com/apple/swift/blob/master/stdlib/public/core/FloatingPoint.swift.gyb#L257</a></div><div class=""><a href="https://github.com/apple/swift/blob/master/stdlib/public/core/FloatingPoint.swift.gyb#L1588" class="">https://github.com/apple/swift/blob/master/stdlib/public/core/FloatingPoint.swift.gyb#L1588</a></div><div class="">There are a few unimplemented (but planned) initializers on FloatingPoint and BinaryFloatingPoint that would make this happen.</div><div class="">If and when those are implemented, you would be able to write the version of numericCast&lt;I : BinaryInteger, F : BinaryFloatingPoint&gt;() using those.</div><div class=""><br class=""></div><div class="">Hope this answers your question.</div><div class=""><br class=""></div><div class="">Max</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Jan 17, 2017, at 9:43 AM, Ben Rimmington &lt;<a href="mailto:me@benrimmington.com" class="">me@benrimmington.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">&lt;<a href="https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c" class="">https://gist.github.com/moiseev/62ffe3c91b66866fdebf6f3fcc7cad8c</a>&gt;<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public protocol Arithmetic {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;init?&lt;T : BinaryInteger&gt;(exactly source: T)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public protocol BinaryInteger : Arithmetic {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span> &nbsp;init?&lt;T : FloatingPoint&gt;(exactly source: T)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}<br class=""><br class="">Should the `init?(exactly:)` initializers belong to the same protocol?<br class="">Would this allow generic conversions between integer and floating-point types?<br class="">For example, a failable `numericCast` function.<br class=""><br class="">-- Ben<br class=""><br class=""></div></div></blockquote></div><br class=""></body></html>