Floating-Point Representation of 500.0 for IEEE

First, convert 500.0 from the decimal representation to a representation with base 2:

  value = (-1)^s * m*2^exp
  
  

where: s, sign is 0 or 1,

2 > m >= 1 for IEEE,

and exp is a integral number.

For 500, this gives:

  sign (500.0) = 1,
  
  
  m, mant (500.0, IEEE) = 1.953125, and
  
  
  exp (500.0, IEEE) = 8
  
  
Note: The number 0 (zero) cannot be represented this way. So for 0, IEEE defines a special bit pattern consisting of 0 bits only.

Next, convert the mantissa into its binary representation.

  mant (500.0, IEEE) = 1.953125
  
  
  = 1*2^(0) + 1*2^(-1) + 1*2^(-2) + 1*2^(-3) + 1*2^(-4)
  
  
            + 0*2^(-5) + 1*2^(-6) + 0*...
  
  
  = 1.111101000... (binary)
  
  

Because this number is converted to be larger or equal to 1 and smaller than 2, there is always a 1 in front of the decimal point. For the remaining steps, this constant (1) is left out in order to save space.

     mant (500.0, IEEE, cut) = .111101000...
  
  

The exponent must also be converted to binary format:

     exp (500.0, IEEE) = 8 == 08 (hex) ==  1000 (binary)
  
  

For the IEEE formats, the sign is encoded as a separate bit (sign magnitude representation)