<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=""><div class="">Musical time signatures is an odd case, because you really have pairs of integers (i.e. if they were rational numbers, then 6/8 would be the same as 3/4. They are not the same).</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 9:36 AM, T.J. Usiyan &lt;<a href="mailto:griotspeak@gmail.com" class="">griotspeak@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Musical time signatures and note duration. Visual code with proportional relationships.</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Dec 7, 2015 at 7:41 PM, Stephen Canon via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</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 class="">Can you guys specify some of the use cases that you have in mind for a Rational type?&nbsp; You mention "alleviating the pain points of floating-point math,” but rationals tend to be used *very* differently from floating-point types in computation.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">– Steve</div><span class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 5:44 AM, Davide De Franceschi via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class="">While I agree that a Rational type, one that would preserve quotient and denominator info, would be very nice, I think that it's more fit for a Math framework.<div class="">If we're just talking about a type that holds precise decimal info, I think making NSDecimal (planned to be renamed as Decimal in the future) usable is what we should do.</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 7 Dec 2015, at 10:28, T.J. Usiyan via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div dir="ltr" class="">I'm all for a stdlib Rational Type. I've written one as well and would be glad not to have to include it as a dependency everywhere.<div class="">TJ</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Dec 7, 2015 at 1:31 PM, Harlan Haskins via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</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="">If Swift 3 is going to focus on re-thinking the Numerics in the system, it might be worth considering adding a Fraction (or Rational) type to the standard library. This, coupled with an arbitrary-precision integer type, would be a great way to handle arbitrary-precision decimal arithmetic, and can alleviate almost all the pain points of floating-point math.<div class=""><br class=""></div><div class="">There exist now some really nice implementations of Fractions, but the ones I’ve seen haven’t been implemented fully generically.</div><div class="">My favorite is this one: <a href="https://gist.github.com/JadenGeller/5e80ebf32442acc62e8e" target="_blank" class="">https://gist.github.com/JadenGeller/5e80ebf32442acc62e8e</a></div><div class=""><br class=""></div><div class="">I’d love to see some standard library support with rock-solid, fast implementations of all the common algorithms (GCD, LCD, LCM, reduction, etc) and good conformance to the builtin integer protocols. Maybe even <font face="Menlo" class="">FloatLiteralConvertible</font>, too, with some logic for converting rational floats.</div><div class=""><br class=""></div><div class="">Thoughts?</div><div class=""><br class=""></div><div class="">- Harlan Haskins</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=3FGfocPbgxkNkmje7djckg9Iw-2BGYY3X6RxJ1tkUXKCr1mGWLtle38JhdUCkzNvAFKca8BI2IZiTedPLguLDg1TtEYLXGYWH-2BewJkLb-2BjDBcqBgL2BYa-2Bl3NtT5XEQq3q0-2BrFJrSHllGvw98ZC-2Fu4xrlfCCw4-2BsieLIEsY7P-2BUNjLXPzadS22jPmYlmgrNHQz8IRukh5taYbBZlJSrd3mryYE4ngwTngf508M5-2BYT-2Bk8-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important" class="">
</div>
</blockquote></div></div></div></blockquote></div></div></div></div></blockquote></div><br class="">
</span><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=3FGfocPbgxkNkmje7djckg9Iw-2BGYY3X6RxJ1tkUXKCoQ3YFWLsZ-2BYCV6JkbPtPBTovpfdYuFjob0D7vDUOPzvYSefb94d3X9sPA-2FgwlL7VPpBdIRmxgZX3jx4T0-2BVJKMwjsfrRtQw3PnIOj7a3bR-2B1hknhjq5r5yorugg3SdYzBOumq689bV-2FKakO2cxS4ugK3RmqcpQMxBmn7KN0bnJ-2FFZk-2BuglSA-2B1rPSXeKjhsSk-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important" class="">
</div>
<br class="">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>