Taking a decimal fraction 0.0901and converting to a fixed-point value with 2 integer bits and 22 fractional bits (24 bits in total):
Ruby syntax used for math (you can cut and paste the command line tool into an IRB (interactive ruby)):
i = (0.0901 * 2**20)
i = i.to_i
i.to_s(2)
To add leading zeros (24-bit length), right alignment and pad with 0
i.to_s(2).rjust(24, '0') # "000001011100010000110010"
# Convert to Hex (base 16)
i.to_s(16) # "5c432"
, , :
(0.0065 * 2**22).to_i.to_s(2).rjust(24, '0')
=> "000000000110101001111110"
"000000000110101001111110"
"111111111001010110000001"
"111111111001010110000001" + 1
"111111111001010110000010"
24'b100000000110101001111110, MSB, 1, . , , - Sign Magnitude, ( ).
NB: . 377906.7904. , 0.7904, .