Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Ios has the problem of precision loss of floating-point strings during json parsing.
Ios has the problem of precision loss of floating-point strings during json parsing.
When there is a string with two decimal places, many decimal places will suddenly appear after the decimal point. For example, the data returned by the background is 9.881 or 9.799999999999999 after parsing, which is because the precision of floating-point string is lost during parsing.

To correct the parsed floating-point string, the correction method is as follows.