precision manipulator in C++

#include <iostream>
#include <iomanip>
using namespace std;

int main () {
double i=1.2345;
cout<<setprecision(5)<<i<<endl;
cout<<setprecision(15)<<i<<endl;
cout<<setprecision(20)<<i<<endl;
return 0;
}

in the above prog, 9's are appended when value of precision is large bot not when value of precision is small. Why??
Topic archived. No new replies allowed.