Floating Point Example - Storing a Non-Integer
What is the floating-point representation of -483.13710 ? First we must convert this number to base-2.
Remember that any integer, N, in base-10 can be represented as the sum
{... + a3×23 + a2×22 + a1×21 + a0×20}, where the ai values are either 0 or 1. If we divide N by 2, and there is a positive remainder, then a0=1. Otherwise, a0=0. Dividing the integer part of N/2 by 2, we can determine the value of a1 and so on. The base-2 representation of N is thus {... a3a2a1a0}. As shown below, 48310 = 1111000112.

 483/2 = 241 Remainder: 1 a0 241/2 = 120 1 a1 120/2 = 60 0 a2 60/2 = 30 0 a3 30/2 = 15 0 a4 15/2 = 7 1 a5 7/2 = 3 1 a6 3/2 = 1 1 a7 ½ = 0 1 a8

A decimal number between 0 and 1, .F, in base-10 can be represented as the sum
{b1×2-1 + b2×2-2 + b3×2-3 + ...}, where the bi values are either 0 or 1. If we multiply .F by 2, and the result is greater or equal to one, then b1=1. Otherwise, b1=0. Multiplying the fractional part of .F×2 by 2, we can determine the value of b2, and so on. The base-2 representation of .F is thus .{b1b2b3...}. As shown below, 0.13710 = .001000112, truncated to 8-places.

 0.137×2 = 0.274 + 0 b1 0.274×2 = 0.548 + 0 b2 0.548×2 = 0.096 + 1 b3 0.096×2 = 0.192 + 0 b4 0.192×2 = 0.384 + 0 b5 0.384×2 = 0.768 + 0 b6 0.768×2 = 0.536 + 1 b7 0.536×2 = 0.072 + 1 b8

Thus we have that 483.13710 _ 111100011.001000112. In base-2 scientific notation, the approximate value is 1.1110001100100011×101000. Adding the bias to the exponent yields 10000000111. Taking in account the negative sign and dropping the leading 1 from the mantissa, the 3-byte floating-point representation of _483.13710 is

 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 0 0 1 0 byte 1 byte 2 byte 3

Note that not all of the mantissa can be stored. The remainder is truncated. If four or more bytes were available, more of the mantissa could be kept. In hexadecimal form, this number is C07E3216. The actual base-10 number represented by this floating-point number is -483.12510.