ios - 精度丢失问题
2020-06-23 本文已影响0人
biubiuboom
- (NSString *)accuracyString
{
//直接传入精度丢失有问题的Double类型
double conversionValue = [self doubleValue];
NSString *doubleString = [NSString stringWithFormat:@"%lf", conversionValue];
NSDecimalNumber *decNumber = [NSDecimalNumber decimalNumberWithString:doubleString];
return [decNumber stringValue];
}