I'm taking in a float as input, and then outputting its equivalent representation in base 2 scientific notation. This is in IEEE 32 bits with: 31 sign bit, 23-30 exponent (with 127 offset), 0-22 mantissa (with implicit leading 1).
One of the conditions which I'm not exactly sure the meaning of is "Your mantissa should have the implicit leading 1 prepended."
All I've really learned is to break up the float into its decimal and fractional parts, and separately get their binary representations.
Since I'm not sure how to do this... I can't really code it. I'd appreciate any tips or information on some sort of algorithm for doing so, or the code itself. Thanks.
Sample:
Input: -40.1 Output: -1.01000000110011001100110 E101
Input: 13.5 Output: 1.10110000000000000000000 E11
EDIT: 127 offset means excess 127 notation right? My book only has excess 128, but I don't know the difference anyways...