I am writing a piece of code in which I need to convert from double to float values. I am using boost :: numeric_cast to do this conversion, which will warn me of any overflow / stream. However, I am also interested to know if this conversion led to some kind of precision loss or not.
for example
double source = 1988.1012; float dest = numeric_cast<float>(source);
Produces dest, which matters 1988.1
Is there any way in which I can detect this type of accuracy loss / rounding
c ++ floating-point floating-accuracy rounding rounding-error
Yogesh arora
source share