Thursday, July 25, 2019
Investigate data representations Essay Example | Topics and Well Written Essays - 1000 words
Investigate data representations - Essay Example The above scheme can work fine as long as there are ââ¬Å"unsignedâ⬠numbers. A strategy had to be evolved to represent ââ¬Å"signedâ⬠numbers with consistent representation of negative as well as positive numbers. Several representation systems exist to represent signed numbers like the sign-and-magnitude, oneââ¬â¢s complement, twoââ¬â¢s complement, etc. Sign-and-magnitude and oneââ¬â¢s complement both use the most significant bit to represent the sign of the number with 0 for positive and 1 for negative sign. An anomaly arises in the representation of the number zero itself. Since the most significant bit denotes the sign, a zero can be both ââ¬Å"negativeâ⬠, as in 10000000, as well as ââ¬Å"positiveâ⬠, as in 00000000. This ambiguity has led modern computer systems design to adopt the twoââ¬â¢s complement which does not have this ambiguity. Twoââ¬â¢s complement represents positive numbers by converting simply from decimal to binary. So, a decimal 4 in 4-bit representation would become 0100. Zero is uniquely represented by 0000. Negative numbers are first complemented and then a 1 is added to the result. A generic formula would be 2N-A+1 where N is the number of bits used and A is the number to be converted. See example of converting decimal -3 to twoââ¬â¢s complement below: Arithmetic functions can be purely addition based and no subtraction remains necessary. Subtraction can be performed by adding the twoââ¬â¢s complement representations. The resulting number is the twoââ¬â¢s representation of final result. The range of uniquely representable numbers in N-bit systems are -2N-1 to +-2N-1-1 (Dandamudi 886). Floating point numbers are represented differently. They are divided into three parts, the sign bits for exponent and mantissa, the exponent and the mantissa. For example, if 205.347 is to be represented, it is first brought to a ââ¬Å"normal formâ⬠of 2.05347 x 102 where 205347 is the mantissa and the power of 2 is the
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment