Round Issue in swift
问题 I have this Info. let params2: [String: AnyObject] = [ "app_token": myapptoken, "member_access_token": accessToken!, "pay_process": 0, "payamount_credit": 9.87 //hardcode ] When print params2 The result is ["app_token": myapptoken, "member_access_token": accessToken, "payamount_credit": 9.869999999999999, "pay_process": 0] The "payamount_credit": 9.87 now is "payamount_credit": 9.869999999999999 I have tried all the ways that exist round but behaves the same. NSString(format: "%.\2f", 9.87)