Below is the solution code for an excercise from KN King\'s Modern Programming approach.
#include
int main(void)
{
int i;
float j,x;
A double is not infinitely accurate, and it does not store numbers in decimal, so it cannot precisely store 0.085. If you want to print a number to two significant figures, use the precision format specifier - see http://www.cprogramming.com/tutorial/printf-format-strings.html for examples.
double value = 0.085;
NSLog(@"%.2g", value);
This will print "0.085"
Be aware that using the precision specifier normally controls the number of digits displayed after the decimal point - but in the case of a double, it controls significant figures.
float value = 0.085;
NSLog(@"%.2f", value);
Will print "0.09"