M
Mike
I am trying to calculate a 32bit float value from 4 int values.
I sucessfully calcluated a 32bit long value:
LONG l32BitData = pData[3];
l32BitData <<= 8;
l32BitData |= (byte)pData[2];
l32BitData <<= 8;
l32BitData |= (byte)pData[1];
l32BitData <<= 8;
l32BitData |= (byte)pData[0];
But when I use type casting I (unsuprisingly) get the wrong value of
float.
Does anyone know a good way of calculating this? An IntToFloat()
function would be perfect or a description of the steps required to
calculate this. I have read how to calculate an intiger value from a
float but the required maths to do the reverse is beyond me.
Any help greatly appreciated.
Mike
I sucessfully calcluated a 32bit long value:
LONG l32BitData = pData[3];
l32BitData <<= 8;
l32BitData |= (byte)pData[2];
l32BitData <<= 8;
l32BitData |= (byte)pData[1];
l32BitData <<= 8;
l32BitData |= (byte)pData[0];
But when I use type casting I (unsuprisingly) get the wrong value of
float.
Does anyone know a good way of calculating this? An IntToFloat()
function would be perfect or a description of the steps required to
calculate this. I have read how to calculate an intiger value from a
float but the required maths to do the reverse is beyond me.
Any help greatly appreciated.
Mike