I stumbled on a function that I think is unnecessary, and generally scares me:
float coerceToFloat(double x) {
volatile float y = static_cast<float>(x);
return y;
}
Which is then used like this:
// double x
double y = coerceToFloat(x);
Is this ever any different from just doing this?:
double y = static_cast<float>(x);
The intention seems to be to just strip the double down to single precision. It smells like something written out of extreme paranoia.