Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explain why the hidden bit of floating point format does not need to be represented

Explain why the hidden bit of floating point format does not need to be represented.

help? I know that the hidden bit exists for more precision but why doesn't it need to be represented?

like image 378
Jordan Avatar asked Oct 25 '12 07:10

Jordan


People also ask

What is the hidden bit in floating-point?

Many floating point representations have an implicit hidden bit in the mantissa. This is a bit which is present virtually in the mantissa, but not stored in memory because its value is always 1 in a normalized number.

Why is floating-point representation required?

Floating point representation makes numerical computation much easier. You could write all your programs using integers or fixed-point representations, but this is tedious and error-prone.

How are floating-point numbers represented?

In computers, floating-point numbers are represented in scientific notation of fraction ( F ) and exponent ( E ) with a radix of 2, in the form of F×2^E . Both E and F can be positive as well as negative.

Why is floating-point not exact?

Floating-point decimal values generally do not have an exact binary representation due to how the CPU represents floating point data. For this reason, you may experience a loss of precision, and some floating-point operations may produce unexpected results.


3 Answers

If you mean by the hidden bit the the one preceding the mantissa H.xxxxxxx, H=hidden, the answer is that it is implicitly 1, when exponent>0 and it's zero, when exponent==0.

Omitting the bit, when it can be calculated from the exponent, allows one more bit of precision in the mantissa.

like image 92
Aki Suihkonen Avatar answered Nov 07 '22 00:11

Aki Suihkonen


@Aki's answer is correct. The implied bit is not always 1.

For 0.0, -0.0 & denormal numbers (gradual underflow) the implied bit if any would be 0.
Those numbers are all the ones having a zero biased exponent.

Non finite float (+inf -inf NaN) don't need any concept of implied bit at all.
Though, adding such a bit wouldn't hurt
Those numbers are all the ones having biased exponent set to all ones.

For every other float, implied bit would be 1.

Technically, the answer is that we don't need to store the implied bit because we put additional logic in FPU circuitry to reconstruct it from above rules ;).

For example, the implied bit could be obtained by ORing all the bits of biased exponent, so it's not that expensive after all.

like image 26
aka.nice Avatar answered Nov 06 '22 23:11

aka.nice


It will be always one so we don't represent it You will only get a hidden bit when you normalize a binary number and the meaning of normalization is writing a number in the form of

1.xxxx x 2^x (eg: 110.11 becomes 1.1011x2^2)

so the first bit always becomes 1 so we don't need to represent it

like image 35
Dayalan Arockiyanathan Avatar answered Nov 07 '22 00:11

Dayalan Arockiyanathan