<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><div><span style="background-color: rgba(255, 255, 255, 0);">(resending to mailing list)</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">I'm all for Fraction type as well, although I would prefer it to be called Rational for the following reasons:</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">- Although all rational numbers are technically fractions (with whole numbers having denominator of 1), it might mislead developers that it's applicable only to fractions of type p/q: q ≠ 1, q ≠ 0</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">- The name Rational is mathematically-correct</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><br><div>Pozdrawiam – Regards,</div><div>Adrian Kashivskyy</div><div><br></div>Wysłane z iPhone'a</div><div><br>Dnia 07.12.2015 o godz. 11:44 Davide De Franceschi via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> napisał(a):<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">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><blockquote type="cite" class=""><div class="">On 7 Dec 2015, at 10:28, T.J. Usiyan via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><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=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></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>
<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>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=UNDxqBUDZDpZmPmXfIKeZ1UxMq-2BwsURX5ulfpb2jFAb7Fr-2B9NviBmWgtjjOe77nZqOVkc0JgAcimPmGQF3PbEdSjl-2FJaFCTZJoQtlKKgosTz7m-2Bt1OsZlC3LCpn25QNlcB5ENr1EsexNJTmW4c55LBH4f7gxiQolTIzTGk0OhfAJSonAk3b86sTgylPlQ0hZxqmG5MqpNote2sTDFadENU5oAiPss0EKq9rae5-2FjeYY-3D" alt="" width="1" height="1" border="0" style="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="">
_______________________________________________<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">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=Q0Y0L54uOhrrHtFzGFlMmzHCkni7p1uaN05dut7Y5S66cXP1EPPrxxcDj89NYg8JV-2BXhIjcvH5Nl04nF1aRv-2BnXK0roCqPcagXPlWKZbvU5EzQ1M7rj7Mu1CFB-2BvNLpM9EUcVW1yx5GqWYSytd86HXmai0O9-2F11GKjKULD-2BjP2dxWQPOfwUzl35Q7MgEOcWpryaPu12kUI-2BC5SNlmlxt-2FgjPV2Z-2B-2BsWrMeJMuA1dgCA-3D" alt="" width="1" height="1" border="0" style="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><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>