<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="">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" 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></body></html>