<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">After implementing the proposal <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0170-nsnumber_bridge.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0170-nsnumber_bridge.md</a>&nbsp;we have gotten some initial feedback.</div><div class=""><br class=""></div><div class="">It seems that there is definitely a fair amount of confusion and heartache for dealing with Float and Double values being bridged.&nbsp;</div><div class=""><br class=""></div><div class="">Specifically the cases like:</div><div class=""><br class=""></div><div class="">NSNumber(value 0.1) as? Float</div><div class=""><br class=""></div><div class="">which with the current implementation will return nil since the Double value 0.1 cannot be represented exactly as a Float.</div><div class=""><br class=""></div><div class="">It seems like the overwhelming majority of users know full well that Float will result in a loss of precision (hence why they chose that type over Double). This means that the floating point bridges for Double, Float, and CGFloat should not be the pedantic “exactly” cases but instead infer the conversion intent of a lax/approximated version.</div><div class=""><br class=""></div><div class="">So in short: for the betterment of the API ergonomics, the floating point types as destinations will be pulled back to their initial Swift 3 behavior.</div><div class=""><br class=""></div><div class="">Additionally to aide appropriate migration to the appropriate truncating/exactly initializers the un-labeled, deprecated in Swift 4, plain init methods to the numeric types with an NSNumber will now be annotated with the suggested replacements.</div><div class=""><br class=""></div><div class="">Thanks for your time and feedback,</div><div class="">Philippe Hausler</div></body></html>