Streams round numbers, so you can use manipulators to get the number rounded
1 2 3 4
double n = /*something*/;
stringstream ss;
ss << setprecision(10) << n; // output the rounded number on the stream
ss >> n; // put the rounded value back to the number
Notice that doubles themselves aren't much precise