This is the used code:

float fValue(250.84f);
double dValue(0.0);
dValue = static_cast<double>(fValue);
cout<<fValue<<endl;
cout<<dValue<<endl;


When I put a breakpoint on the first cout statement, the value of fValue is in the debugger 250.840. The value of the dValue is 250.83999633789.

When continue the program, the output on screen is 250.84 for each value.

But this is not correct because to my opponion the cout-statement interprets the dValue as a float and rounds the value automatically. In real world I'm not using the values to output them on screen. I work with the binary data (the 4 bytes of the float and the 8 bytes of the double value) and I perform calculations on these double-values. Therefor I must have the exact same values for the double type as for the float type.

Any solutions?