A negative floating number to binary -


so exercise says: "consider binary encoding of real numbers on 16 bits. fill empty points of binary encoding of number -0.625 knowing "1110" stands exposant , minus 1 "-1"

                _ 1110_ _ _ _ _ _ _ _ _ _ _                              " 

i can't find answer , know not hard exercise (at least doesn't hard one).

let's ignore sign now, , decompose value 0.625 (negative) powers of 2:

0.625(dec) = 5 * 0.125 = 5 * 1/8 = 0.101(bin) * 2^0 

this should normalized (value shifted left until there 1 before decimal point, , exponent adjusted accordingly), becomes

0.625(dec) = 1.01(bin) * 2^-1 (or 1.25 * 0.5) 

with hidden bit

assuming have hidden bit scenario (meaning that, normalized values, top bit 1, not stored), becomes .01 filled on right 0 bits, get

sign = 1                        -- 1 bit exponent = 1110                 -- 4 bits significand = 0100 0000 000     -- 11 bits 

so bits are:

1 1110 01000000000 

grouped differently:

1111 0010 0000 0000(bin) or f200(hex) 

without hidden bit (i.e. top bit stored)

if there no hidden bit scenario, becomes

1 1110 10100000000 

or

1111 0101 0000 0000(bin) = f500(hex) 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -