<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 am not a numerics expert…… just have run into people using floats in banking and brokerage systems to do calculation with decimal numbers too many times in my life…. &nbsp;I even spent a whole night in a bank vault with the system on conversion trying to figure out why it was out by a single penny :o<div class=""><br class=""></div><div class="">If I were not mentally unstable beforehand I would have gone insane over the misuse of floats, and the lack of languages having good decimal numeric types :p</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On 2015-12-19, at 5:47:58, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 1:19 PM, Craig Cruden 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=""><a href="http://www.exploringbinary.com/why-0-point-1-does-not-exist-in-floating-point/" class="" style="font-family: AvenirNext-Regular; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">http://www.exploringbinary.com/why-0-point-1-does-not-exist-in-floating-point/</a><div class="" style="font-family: AvenirNext-Regular; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: AvenirNext-Regular; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 2015-12-19, at 4:17:45, Craig Cruden &lt;<a href="mailto:ccruden@novafore.com" class="">ccruden@novafore.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Floating point numbers by their very nature are approximation represented in binary. &nbsp;Many numbers in Decimal cannot be represented exactly in decimal floating point format. &nbsp;<div class="">So after math calculations decimal number -&gt; floating point binary -&gt; repeating decimal numbers.</div><div class=""><br class=""></div><div class="">If decimal accuracy such as accounting, you should avoid using floats altogether and stick to Decimal type numbers (in java it is called BigDecimal, in Swift they have NSDecimalNumber I think which has it’s own issues.</div></div></div></blockquote></div></div></div></blockquote><div class=""><br class=""></div>Just for background and to save time, I’ll note out that Steve is one of Apple’s most respected numerics experts, and he’s more familiar with the details of how floating point, decimal, and other numeric representations work than just about anyone I’ve ever met.</div><div class=""><br class=""></div>FWIW-ly y’rs,</div><div class=""><br class=""><div class="">
-Dave<div class=""><br class=""></div><br class="Apple-interchange-newline">

</div>
<br class=""></div></div></div></blockquote></div><br class=""></div></body></html>