Alex Rivera | Logout

What is a "bias value" of floating-point numbers?

Asked 2010-05-14T15:17:34.947
71

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?

Edit
Report

1 Answer

19

Adding more detail to above answers.

To represent 0, infinity and NaN (Not-a-Number) in floating point, IEEE decided to use special encoding values.

  • If all bits of the exponent field are set to 0, then the floating-point number is 0.0.

  • If all bits of the exponent field are set to 1 and all bits of the fraction part are 0, then the floating-point number is infinity.

  • If all bits of the exponent field are set to 1 and all bits of the fraction part are not equal to 0, then the floating point number is NaN.

So, in single-precision we have 8 bits to represent the exponent field and there are 2 special values, so we basically have 256 - 2 = 254 values that can be represented in exponent. So, we can effectively represent -126 to 127 in the exponent, i.e., 254 values (126 + 127 + 1), 1 is added for 0.

answered 2013-04-21T03:14:52.813

Your Answer