I think I have a convertingproblem when using stringstream.
I multiply 0.995 * 19.99 wich is: 19.89005
The first messageBox do show because 19.89 < 19.89005.
Then I convert Total to string and back to double again and do
the same check if: 19.89 < NewNumber
But here the MessageBox doesn´t show so I beleive there is something
that happens with the decimals when converting like I do. (Red Area)
Is it possible to not lose decimals when doing a conversion to string and back to
double like I do ?
Wonder if this is the problem that I think.
double Total = 0.995 * 19.99; //Gives 19.89005
std::string Replacing;
if( 19.89 < Total )
{
MessageBox::Show("Before");
}
/*................................................*/
stringstream c1;
c1 << Total;
Replacing = c1.str();
double NewNumber = 0;
stringstream v1(Replacing);
v1 >> NewNumber ;
if( 19.89 < NewNumber )
{
MessageBox::Show("After");
}