I have an NSNumber object from json.
I want to convert to NSString for display, but the result is weird.
NSNumber *num = @(98.9);
NSString *numString = [num stringValue];// output 98.90000000000001
The JSON I got from the server is
{"Price": 98.9}
I need to show it to the UILabel 98.9, But the result is 98.90000000000001
The number of decimal places is uncertain
Maybe
{"Price": 98.91}
or
{"Price": 98.901}
I need to display the same as in json
You can do it with
stringWithFormat: