Hi, does anyone know, why this is the case:
// Given a single precision float flt (23 bit mantissa) with intV and fltV being the integer and the fraction part respectively, so: flt = (float) intV + fltV
float flt = ...
// Do this
flt = flt + (float) (1 << 23)
// Now somehow the mantissa of flt has become exactly the bitwise representation of intV, so:
(int) flt & (mantissa_mask = (1<<23)-1)
// gives exactly intV, the truncated flt value.
I would be greatful if somebody provides some info on the matter, how this great magic works!
edit: No, sorry, the code seems to perform a nearest rounding.