floating point in computer architecture

Extreme cases of floating point Numbers:

1)When the exponent number becomes larger

Floating point numbers are represented in IEEE formats.

Let us consider IEEE 754 : 32 Bit Format

SBiased ExponentMantissa
(1)(8)
Bias value=127
(23 bits)
  • 32 bits are used to store the numbers.
  • 23 bits are used for Mantissa.
  • 8 bits are used for the Biased Exponent.
  • 1 bit is used for the sign of the number.
  • The Bias value is (127)10
  • The range is +1 x 10-38 to +3 x 1038 approximately.
  • It is called a single precision format for floating point numbers.

For value 1.0,normalized form is

(-1)0 x 1.0 x 2

True exponent(TE)=0

If:  TE = 0,    BE=127 ,   Representation = 0111 1111

If:  TE = 1,    BE=128 ,   Representation = 1000 0000

If:  TE = 2,    BE=129 ,   Representation =  1000 0000

If:  TE = 127,    BE=254 ,   Representation =  1111 1110

If:  TE = 128,    BE=255 ,   Representation =  1111 1111

If:  TE = 129,    BE=255 ,   Representation =  1111 1111

If:  TE = 130,    BE=255 ,   Representation =  1111 1111

  • 8-bit based exponent cannot hold value more than 255.Hence, all cases where TE =128 or more,the BE will be represented as 1111 1111.
  • This indicates an exception or error called overflow.
  • The number is called NaN(Not a number).
  • It is identified by exponents being all 1’s(1111 1111).
  • Mantissa can be anything.

The extreme case of overflow is Infinity:

  • It is not a regular NaN.
  • The exponent will be 1111 1111.
  • To differentiate NaN with infinity,the mantissa in infinity is 0000 0000
  • Infinity is identified as exponent all 1’s and mantissa with all 0’s.

2)When the exponent number becomes small reaching towards zero

Let us assume a vale 0.1,normalised form is

(-1)0 x 1.0 x 2-1

True exponent(TE)=-1

If:  TE = -1,    BE=126 ,   Representation = 0111 1110

If:  TE = -2,    BE=125 ,   Representation = 0111 1101

If:  TE = -126,    BE=1 ,   Representation =  0000 0001

If:  TE = -127,    BE=0 ,   Representation =  0000 0000

If:  TE = -128,    BE=0 ,   Representation =  0000 0000

If:  TE = -129,    BE=0 ,   Representation =  0000 0000

  • 8-bit based exponent cannot hold value more than 255.Hence, all cases where TE =-127 or less,the BE will be represented as 0000 0000.
  • This indicates an exception or error called underflow.
  • The number is called De-Normal Number.
  • It is identified by exponents being all 0’s(0000 0000).
  • Mantissa can be anything.

The extreme case of underflow is Zero:

  • It is not a regular De-Normal.
  • The exponent will be 0000 0000.
  • To differentiate de-normal with Zero,the mantissa in Zero is 0000 0000
  • Zero is identified as exponent all 0’s and mantissa with all 0’s.

Summary

NumberExceptionExponentMantissa
Normal NumberNo error0<E<255Anything
NaNoverflow1111 1111Anything
Infinityoverflow1111 11110000 0000
De-Normal numberunderflow0000 0000Anything
Zerounderflow0000 00000000 0000
Spread knowledge

Leave a Comment

Your email address will not be published. Required fields are marked *