Tags

,


Here is another Wolfram demo. This one converts a decimal number to a floating point binary representation.  To play with the demo, download the free CDF player first.
 
The total number of bits used for the representation =
       one bit for the sign of the number +
       one bit for the sign of the exponent +
       number of bits for the exponent +
       number of bits for the mantissa +
       As an example, how would 54.75 be represented in a 9-bit register where the first bit is used for the sign of the number, second bit is used for sign of exponent, next three bits are used for the exponent, and the last four bits are used for the mantissa?
Both the number and the exponent are positive. 
As the number is normalized to lie between 1 and 2 (the interval being half-closed at the bottom and half-open at the top), the leading binary digit is always 1. So we do not actually use it in the representation of the mantissa. Hence the mantissa bits are 1011. Moreover the exponent bits are 101, the sign of the number bit is 0, and the sign of the exponent bit is 0.
Therefore the representation is .
 

Reference: Floating Point Representation

This post is brought to you by

Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, the textbook on Introduction to Programming Concepts Using MATLAB, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos.  Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

Advertisements