<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I prefer an approach that preserves how I am used to seeing math expressions. I use this myself:<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="color: #ba2da2" class="">protocol</span> FloatingPointMath: <span style="color: #703daa" class="">FloatingPoint</span></div><div style="margin: 0px; line-height: normal;" class="">{</div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> sqrt(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> sin(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> cos(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> tan(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> asin(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> acos(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> atan(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><p style="margin: 0px; line-height: normal; min-height: 13px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> ln(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> log(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>, base: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> pow(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>, exponent:<span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp; <span style="color: #ba2da2" class="">static</span> <span style="color: #ba2da2" class="">func</span> exp(<span style="color: #ba2da2" class="">_</span> value: <span style="color: #4f8187" class="">Self</span>) -&gt; <span style="color: #703daa" class="">Self</span></div><div style="margin: 0px; line-height: normal;" class="">}</div><div class=""><br class=""></div></div></div><div class="">It does not pollute the global namespace and gives nice contextual auto-completion. &nbsp;And I don’t want it in the standard library: I only add the file when I need it. (it is not a separate module for optimization reasons).</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 31, 2017, at 10:29 AM, Taylor Swift via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Jul 31, 2017 at 1:23 PM, Adrian Zubarev <span dir="ltr" class="">&lt;<a href="mailto:adrian.zubarev@devandartist.com" target="_blank" class="">adrian.zubarev@devandartist.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div id="m_-5678978844789218338bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;" class="">I’m not sure how I would feel about this. To be honest I’d avoid such additional changes from the stdlib, because they really don’t belong there. Instead some `Math` module/package would be a better fit than clustering everything into stdlib until we end up also adding UI stuff.</div> <div class=""><br class=""></div>Furthermore, I don’t think a function would make any sense here. It really should be a computed property.<div class=""><div class="h5"><br class=""> <div id="m_-5678978844789218338bloop_sign_1501521568263739136" class="m_-5678978844789218338bloop_sign"></div> <br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">I think a standard Math module would be a good idea, but only if it benefits from the same inlining and specialization as the standard library. Also squareRoot() should be moved to the Math module if it is ever created.<br class=""></div><div class="">&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class="h5"><p class="m_-5678978844789218338airmail_on">Am 31. Juli 2017 um 19:03:49, Taylor Swift via swift-evolution (<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>) schrieb:</p> </div></div><blockquote type="cite" class="m_-5678978844789218338clean_bq"><span class=""><div class=""><div class=""></div><div class=""><div class=""><div class="h5">





<div dir="ltr" class="">
<div class="">How would people feel about adding a protocol<br class="">
<br class="">
<span style="font-family:monospace,monospace" class="">protocol
MathFloatingPoint:<wbr class="">FloatingPoint<br class="">
{<br class="">
&nbsp;&nbsp;&nbsp; func sin() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func cos() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func tan() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func asin() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func acos() -&gt; Self<br class="">
&nbsp;&nbsp;&nbsp; func atan() -&gt; Self<br class="">
<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">&nbsp;&nbsp;&nbsp; func ln()
-&gt; Self<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">&nbsp;&nbsp;&nbsp; func
log(base:Self) -&gt; Self<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">&nbsp;&nbsp;&nbsp; func
pow(exponent:Self) -&gt; Self<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">&nbsp;&nbsp;&nbsp; func exp()
-&gt; Self<br class=""></span></div>
<div class=""><span style="font-family:monospace,monospace" class="">}</span><br class="">
<br class=""></div>
to the standard library? Float and Double would then be made to
conform by default using Swift implementations instead of having to
import Glibc / Darwin and writing the extensions, depending on
platform.<br class=""></div></div></div><span class="">


______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class=""></span></div></div></span></blockquote></div></blockquote></div><br class=""></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>