<div dir="ltr">The example of time signatures has much less to do with modeling the two integers presented to the user and more to do with resolving the absolute duration of a note which is part of why I mentioned both time signature *and* note duration.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 7, 2015 at 8:15 PM, Stephen Canon <span dir="ltr"><<a href="mailto:scanon@apple.com" target="_blank">scanon@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>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><div><div class="h5"><br><div><blockquote type="cite"><div>On Dec 7, 2015, at 9:36 AM, T.J. Usiyan <<a href="mailto:griotspeak@gmail.com" target="_blank">griotspeak@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Musical time signatures and note duration. Visual code with proportional relationships.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 7, 2015 at 7:41 PM, Stephen Canon via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Can you guys specify some of the use cases that you have in mind for a Rational type? 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><br></div><div>Thanks,</div><div>– Steve</div><span><br><div><blockquote type="cite"><div>On Dec 7, 2015, at 5:44 AM, Davide De Franceschi via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div style="word-wrap:break-word">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>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><br><div><blockquote type="cite"><div>On 7 Dec 2015, at 10:28, T.J. Usiyan via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div dir="ltr">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>TJ</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 7, 2015 at 1:31 PM, Harlan Haskins via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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><br></div><div>There exist now some really nice implementations of Fractions, but the ones I’ve seen haven’t been implemented fully generically.</div><div>My favorite is this one: <a href="https://gist.github.com/JadenGeller/5e80ebf32442acc62e8e" target="_blank">https://gist.github.com/JadenGeller/5e80ebf32442acc62e8e</a></div><div><br></div><div>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">FloatLiteralConvertible</font>, too, with some logic for converting rational floats.</div><div><br></div><div>Thoughts?</div><div><br></div><div>- 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">
</div>
</blockquote></div></div></div></blockquote></div></div></div></div></blockquote></div><br>
</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">
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></blockquote></div><br></div>