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;
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