In computer science, the sign bit is a bit in a signed number representation that indicates the sign of a number. Only signed numeric data types have a sign bit, and its place is usually the leftmost, where the most significant bit in unsigned numbers resides. Floating point numbers in IEEE format are always signed, with the sign bit in the leftmost position. Typically if the sign bit is 1 then the number is negative (in the case of two's complement integers) or non-positive (for ones' complement integers, sign-and-magnitude integers, and floating point numbers), while 0 indicates a non-negative number.
In the two's complement representation, the sign bit has the weight −2w−1 where w is the number of bits. In the ones' complement representation, the most negative value is 1 − 2w−1, but there are two representations of zero, one for each value of the sign bit. In a sign-and-magnitude representation of numbers, the value of the sign bit determines whether the numerical value is positive or negative.
When an 8-bit value is added to a 16-bit value using signed arithmetic, the processor unit propagates the sign bit through the high order half of the 16-bit register holding the 8-bit value – a process called sign extension or sign propagation. The process of sign extension is used whenever a smaller signed data type needs to be converted into a larger signed data type while still retaining its original numerical value.
Famous quotes containing the words sign and/or bit:
“Hear, O Israel: The LORD is our God, the LORD alone; You shall love the LORD your God with all your heart, and with all your soul, and with all your might. Keep these words that I am commanding you today in your heart. Recite them to your children and talk about them when you are at home and when you are away, when you lie down and when you rise. Bind them as a sign on your hand, fix them as an emblem on your forehead, and write them on the doorposts of your house and on your gates.”
—Bible: Hebrew, Deuteronomy 6:4-9.
“unless I can shake myself free of my dog, my flag,
of my desk, my mind, I find life a bit of a drag.
Not always, mind you. Usually Im like my frying pan
useful, graceful, sturdy and with no caper, no plan.”
—Anne Sexton (19281974)