setprecision set larger than float sig digits

My instructor explained this to the class but no one could follow it and it is not in the textbook. Would someone please explain this in a manner that makes sense?

Why does fnum display as 42.987652? Where does the last 2 come from?
_____________________________
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double dnum = 42.98765;
float fnum = 42.98765;

cout << setprecision(6) << fixed;
cout << dnum << endl;
cout << fnum << endl;
cout << "Press 'enter' to exit..." << endl;
cin.get();
return 0;
}
Floating point notation leads to precision loss.
"double" actually means "double precision floating point" which means that it stores values in more bits than float.
Thus, you get a better precision using double, as the above example shows
Topic archived. No new replies allowed.