Binary numbers- how to normalize?

AI Thread Summary
To normalize the binary representation of x = 7/10, which is approximately 0.101100110011001100..., one must express it in the form of 1.xxxxx... × 2^n. The process involves shifting the binary point to ensure there is one non-zero digit to the left, while keeping track of the shift count as the exponent. In a 32-bit representation, it's important to allocate bits for the sign and exponent, as well as to round the binary sequence to fit within the bit limit. The nearest machine numbers can be derived by truncating or rounding the binary sequence accordingly. Understanding these principles is crucial for accurate floating-point representation in computing.
ruby_duby
Messages
46
Reaction score
0

Homework Statement



Find the binary form of x= 7/10

Suppose that the number x= 7/10 is to be stored in a 32-bit computer, find the nearby machine numbers x_ and x+


Homework Equations





The Attempt at a Solution



I have found that 7/10 in binary form is: 0.101100110011001100...

However I don not know how to normalise/ standardise this. Can anybody help please!
 
Physics news on Phys.org
Not sure exactly what you mean by normalise.

7/10 like most numbers can't be stored exactly in binary (just as 1/3 can't be stored exactly in decimal)
If you only have 32bits (ie 32 places) what are the nearest 32bit binary numbers made by rounding this sequence up and down? What fractions do they correspond to?
 
ok I'm not entirely sure either if I'm honest but let me try and explain using an example:

If i find that the binary form of x= 2/7 to be: 0.0101001001...

which when normalised becomes: (1.001001001...)x 2^-2

its the last line, that i do not know how to derive
 
0.101100110011001100110011001100

Showing this as 2^-n, ie 1/2 + 1/4 + 1/8 + 1/16, truncating this to 32bits and splitting into 8bits to make it readable
10110011 00110011 00110011 00110011 (0011...)

rounding up the remaining (0011...) would give you
10110011 00110011 00110011 00110100

Now just convert these back into decimals
Now work out what
 
Some more things to think about regarding floating point
  • You better to reserve one of those 32 bits for the sign. Otherwise, how do you represent -7/10?
  • You better reserve some of the remaining 31 bits for the exponent. Otherwise, how do you represent 7/1000000?
  • Every positive number can be expressed as 1.xxxxxx...*2exponent. This is the normalized form. When normalized, there will be one digit to the left of the binary point and it is always one. Do you need to store that leading one?
ruby_duby said:
ok I'm not entirely sure either if I'm honest but let me try and explain using an example:

If i find that the binary form of x= 2/7 to be: 0.0101001001...

which when normalised becomes: (1.001001001...)x 2^-2

its the last line, that i do not know how to derive

It works the same way it works in decimal. Consider 1/400=0.0025. Let's normalized this. In general, you shift the decimal point until you finally get exactly one nonzero digit to the left of the decimal point, keeping track of how many places you moved the decimal point (to the left=positive, right=negative). In this case you have to move the decimal point three places to the right. The normalized form is 2.5×10-3.

No difference conceptually in binary. The base is 2, so instead of multiplying by 10shift count you are multiplying by 2shift count.
 
Back
Top