A
avsrk
Hello Folks ,
General C data types question , more geared up towards embedded folks .
I have a positive float quantity with a fractional part (one decimal
point) which occupies
4 bytes . Now i want to stuff it in to a two byte quantity like
unsigned short and then
reconvert it back to float .
We can use any method like type casting or directly doing low level
operations on the bytes ,
or any other way you can think of ..
The question is , is it possible to get the floating quantity back
including its fractional part .
Ex
float fval = 52.3 ;
unsigned short sval = (unsigned short ) fval ;
float fvalnew = (float) sval ;
will the fvalnew be 52.3 either by the above way( i know it is not we
lose the fractional part) or
any other way .
Thanks
subra
General C data types question , more geared up towards embedded folks .
I have a positive float quantity with a fractional part (one decimal
point) which occupies
4 bytes . Now i want to stuff it in to a two byte quantity like
unsigned short and then
reconvert it back to float .
We can use any method like type casting or directly doing low level
operations on the bytes ,
or any other way you can think of ..
The question is , is it possible to get the floating quantity back
including its fractional part .
Ex
float fval = 52.3 ;
unsigned short sval = (unsigned short ) fval ;
float fvalnew = (float) sval ;
will the fvalnew be 52.3 either by the above way( i know it is not we
lose the fractional part) or
any other way .
Thanks
subra