binary - What is wrong with my IEEE 754 floating point representation? -


i being asked in homework represent decimal 0.1 in ieee 754 representation. here steps made:

enter image description here

however online converters, , answer on stack exchange suggests otherwise. put solution:

s eeeeeeee mmmmmmmmmmmmmmmmmmmmmmm 0 01111011 10011001100110011001101 

the difference number 1 @ right. why isn't 1100, why 1101?

as njuffa said in comment, rounding explanation difference see. converters produce nearest floating-point value decimal number put in. ieee 754 standard recommends rounding mode taken account conversions 1 base (such decimal binary), , default rounding mode “to nearest”.

the 2 closest single-precision floating-point values 1/10 1.10011001100110011001100×2-4 , 1.10011001100110011001101×2-4 (below , above 1/10). digits cut off “11001100…”, indicating real 1/10 closer upper bound lower bound(if remaining digits had been “100000000…”, real number have been in-between two). reason, upper value 1.10011001100110011001101×2-4 chosen conversion of 1/10 binary32 when converting in round-to-nearest mode.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -