Reputation:
Code CGFloat a=3.45378;
I want change the result to CGFloat a=3.45f; only 2 precision
I know how printf works. but I don't know how to do this just keep 2 precision.
Upvotes: 2
Views: 2195
Reputation: 4321
To lose the extra precision, and round to the nearest two decimals, follow these steps:
Upvotes: 3