you are confusing printf and cout.
printf is a C function and I often use it for doubles because it is condensed and all the data being printed is in one place.
that looks like
printf("%1.20f", sin(r));
or you can use cout, the c++ way
cout << std::setprecision(20) << sin(r);
to format several doubles in different formats requires alternating data and calls to setprecision (and maybe setwidth), which makes for very large print statements where the formatting options look exactly the same as the data being printed, so its very hard to read.