In learning how floating point numbers are represented in computers I have come across the term “bias value” that I do not quite understand.
The bias value in floating point numbers has to do with the negative and positiveness of the exponent part of a floating point number.
The bias value of a floating point number is 127, which means that 127 is always added to the exponent part of a floating point number. How does doing this help determine if the exponent is negative or positive or not?
In single precision floating point, you get 8 bits in which to store the exponent. Instead of storing it as a signed two’s complement number, it was decided that it’d be easier to just add 127 to the exponent (since the lowest it could be in 8 bit signed is -127) and just store it as an unsigned number. If the stored value is greater than the bias, that means the value of the exponent is positive, if it’s lower than the bias, it’s negative, if it’s equal, it’s zero.