There is a catch!
I have a IEEE 754 single precision (32 bit) float stored in two consecutive 16bit integers.
The processor I am using doesn't have floating point maths or float data types! What I want to do is convert the float value into a 16bit signed integer. The processor has standard integer maths and bit manipulation (masking, shifting etc).
I except that I will need to lose some precision in going from a 32bit float to a 16bit integer. The integer will also need some implied scaling factor based upon the value ranges in question.
Here's a simple example to make things clearer. Say the float has a range of 0.00 to 10.00. In this case I want the integer to range from 0 to 1000. Note the implied scaling factor of 100. In this case the integer has an implied scaling of 100.
I know that the IEEE 754 contains 1 sign bit, 8 bits for the exponent (with 127 bias) and 23 bits for the mantissa.
I know the equation to reconstruct the value from the float's constituent parts is:
float value = (-1)^Sign_bit * (1+Mantissa) * 2^(Exponent-127).
The main problem I can see is working with 16bit signed integers (range of -32768 to +32767) and avoiding any overflow or underflow.