How to convert from decimal to 16 bit floating point representation (Binary Numbers) and vice versa?


I have been trying for hours and I still can’t figure out how to convert numbers from decimal form to 16 bit floating point representation and vice versa. I get completely confused when complements are introduced so I would like a thorough, but simple enough explanation of it. After hours of going through the…

Binary16 format is described here:
http://en.wikipedia.org/wiki/Half-precis…

You have 1 bit for sign (1)
then 5 bits for exponent (11001)
then 10 bits for your number (1110000000)

A leading 1 is assumed, so your number is really 1.1110000000 (in binary)

Your exponent is 25 (11001), but the exponent bias on binary16 is 15, so multiply the mantissa times 2 to the 10th power (25 – 15 bias).

I would read your number as -(1024 + 512 + 256 + 128) = -1,920.

Do you have a specific binary format (other than IEEE 754) that you are supposed to use?

@M

This Site Might Help You.

RE:
How to convert from decimal to 16 bit floating point representation (Binary Numbers) and vice versa?
I have been trying for hours and I still can't figure out how to convert numbers from decimal form to 16 bit floating point representation and vice versa. I get completely confused when complements are introduced so I would like a thorough, but simple enough explanation of it. After hours of…

47.625
convert 47 into binary and that is 101111.
convert decimal part 0.625 into binary and that is 101.
so,binary of 47.625=101111.101,normalize the number that is 1.01111101*2to the power 5.add the exponent 5 with two to the power four minus one that is 15+5=20.convert 20 into binary that is 10100.
47.625=0 10100 01111101.

0.125

Leave a Comment