# How are bitwise operators used in normalisation of floating-point numbers?

After having spent a significant amount of time googling this topic, I am still struggling to confidently answer the following question:

Identify the process using logical operators to normalise a floating-point number.


My first assumption was, we use the binary shift to remove the leading 0's (for positive numbers) or 1's (for negative numbers) and then use XOR to increase the exponent by the required amount.

I do not understand, however, what happens to the binary point.

Let's say we have the number 1.75 represented as 000001.11 in 8-bits. If I shift it to the right by one place, I lose the 1 at the end. If I shift it to the left by 4 places, how does the computer know to move the binary point between the first two bits from the left? I am lost. How do bitwise operations work in this case?

• Where does the prompt quoted come from? There should be a context with details about normalised floating-point number. – greybeard Sep 23 at 6:49
It's helpful to think of the number in the following representation( I choose 3.75 as an example): $$2^0 * 11.11_2 = 3.15$$ Now $$2^0 = 1$$ so we can just write it in front of the number. Now we want to normalize $$3.75$$ meaning we need to transform it to $$2^e * 1.m$$ where $$e$$ and $$m$$ are some bitstrings. Notice that we can shift a binary number to the left by dividing it by to e.g. $$4 = 100_2 = 2* 010_2 = 2*2* 001_2$$. I hope you can see how dividing/multiplying by 2 corresponds to shifting (in base 2!). Lets shift 3.75 in such a way that a 1 is in front of the comma: $$2^0 * 11.11_2 0 = 2^1* 1.111_2$$; as you can see we shifted 3.75 and thereby pulled a $$2$$ out of it and increased the exponent to account for the $$2$$. The value of the number is still 3.75 it's just written down as $$2* 1.875$$. This is the normalized form. Now the exponent $$e$$ and the places behind the comma are stored in a floating point number. Why don't we need the $$1$$ in front of the comma? Cause the normalized form guarantees that there is a 1 so it's redundant to store it.