Another approach is to add 512 to the number, then AND with 1023. This converts the number to an unsigned value in the range 0 - 1023. Then convert that to a float, and subtract 512.0 to get back to a signed value.
float f = float((x+512)&1023) - 512.0 ;