iOS 精度问题
2016-01-04 11:23
344 查看
后端返回数字类型的数据,AFN解析会出现丢失精度的现象,处理方式:
(1)使用NSDecimalNumber进行处理
NSString *doubleString = [NSString stringWithFormat:@”%lf”,_gbValue.doubleValue];
NSDecimalNumber *decNumber = [NSDecimalNumber decimalNumberWithString:doubleString];
return [decNumber stringValue];
(2)让后端将格式改为字符串
(1)使用NSDecimalNumber进行处理
NSString *doubleString = [NSString stringWithFormat:@”%lf”,_gbValue.doubleValue];
NSDecimalNumber *decNumber = [NSDecimalNumber decimalNumberWithString:doubleString];
return [decNumber stringValue];
(2)让后端将格式改为字符串
相关文章推荐
- iOS库.a与.framework
- iOS沙盒路径总结及存储方法
- iOS国际化
- nagios 监控
- IOSc程序中按钮点击不灵敏 ios
- iOS 头像圆角问题
- Bios工程师手边事—SATA
- 为什么用phonegap开发iOS应用
- 深入NSTimer(iOS)
- iOS-----推送机制(下)
- 不让苹果开发者账号折磨我
- iOS NSLocale相关方法
- 不让苹果开发者账号折磨我
- iOS文章收集
- iOS获取对象属性列表
- iOS导航栏透明
- iOS LaunchImage图片尺寸
- iOS中scrollview的在navigationbarcontroller中使用问题
- iOS常用宏
- Instruments定位iOS应用的Memory Leaks