programer8
programer8

Reputation: 577

Representing 1.0 in IEEE floating point

floating point numbers are described using an sign bit,an exponent and a mantisaa which is of the form 1.XXXXXXX. Since 1 is present by default,it is ignored. So how will 1.0*2^0 be represented in floating point standard? four bytes filled with zeroes? then how is zero represented?

Upvotes: 5

Views: 10996

Answers (1)

Pascal Cuoq
Pascal Cuoq

Reputation: 80284

Zero, or, more precisely, +0.0 is represented with four bytes zero. This should raise a question since zero has no 1 digit to ignore. The fact is that there is one special exponent for which the implicit leading 1 is not assumed. Zero is represented with this exponent, as are so-called subnormal numbers. And the representation of this special exponent is made of bits set to zero.

1.0 is represented with an exponent which is about half the maximum representable exponent, since the goal of IEEE 754 is to allow both very small and very large numbers to be represented. In other words, the exponent is stored with a bias. Out of a possible range of, say, 0..255, the exponent value 0 is used for subnormals and zero, the exponent value 127 is used for 1.0, 128 is used for 2.0, …, and 254 is used for the maximum finite representable number. The exponent value 255 is used for more exceptional floating-point values (infinities and NaN).

The web is full of descriptions and tutorials, so you will have no trouble reading further. You can start with Wikipedia.

Upvotes: 6

Related Questions