# 32bit IEEE 754: Decimal ↗ Single Precision Floating Point Binary: 2.869 Convert the Number to 32 Bit Single Precision IEEE 754 Binary Floating Point Representation Standard, From a Base 10 Decimal System Number

## Number 2.869_{(10) } converted and written in 32 bit single precision IEEE 754 binary floating point representation (1 bit for sign, 8 bits for exponent, 23 bits for mantissa)

### 1. First, convert to binary (in base 2) the integer part: 2.

Divide the number repeatedly by 2.

#### Keep track of each remainder.

#### We stop when we get a quotient that is equal to zero.

- division = quotient +
**remainder**; - 2 ÷ 2 = 1 +
**0**; - 1 ÷ 2 = 0 +
**1**;

### 2. Construct the base 2 representation of the integer part of the number.

#### Take all the remainders starting from the bottom of the list constructed above.

#### 2_{(10) } =

#### 10_{(2) }

### 3. Convert to binary (base 2) the fractional part: 0.869.

#### Multiply it repeatedly by 2.

#### Keep track of each integer part of the results.

#### Stop when we get a fractional part that is equal to zero.

- #) multiplying =
**integer**+ fractional part; - 1) 0.869 × 2 =
**1**+ 0.738; - 2) 0.738 × 2 =
**1**+ 0.476; - 3) 0.476 × 2 =
**0**+ 0.952; - 4) 0.952 × 2 =
**1**+ 0.904; - 5) 0.904 × 2 =
**1**+ 0.808; - 6) 0.808 × 2 =
**1**+ 0.616; - 7) 0.616 × 2 =
**1**+ 0.232; - 8) 0.232 × 2 =
**0**+ 0.464; - 9) 0.464 × 2 =
**0**+ 0.928; - 10) 0.928 × 2 =
**1**+ 0.856; - 11) 0.856 × 2 =
**1**+ 0.712; - 12) 0.712 × 2 =
**1**+ 0.424; - 13) 0.424 × 2 =
**0**+ 0.848; - 14) 0.848 × 2 =
**1**+ 0.696; - 15) 0.696 × 2 =
**1**+ 0.392; - 16) 0.392 × 2 =
**0**+ 0.784; - 17) 0.784 × 2 =
**1**+ 0.568; - 18) 0.568 × 2 =
**1**+ 0.136; - 19) 0.136 × 2 =
**0**+ 0.272; - 20) 0.272 × 2 =
**0**+ 0.544; - 21) 0.544 × 2 =
**1**+ 0.088; - 22) 0.088 × 2 =
**0**+ 0.176; - 23) 0.176 × 2 =
**0**+ 0.352; - 24) 0.352 × 2 =
**0**+ 0.704;

#### We didn't get any fractional part that was equal to zero. But we had enough iterations (over Mantissa limit) and at least one integer that was different from zero => FULL STOP (losing precision...)

### 4. Construct the base 2 representation of the fractional part of the number.

#### Take all the integer parts of the multiplying operations, starting from the top of the constructed list above:

#### 0.869_{(10) } =

#### 0.1101 1110 0111 0110 1100 1000_{(2) }

### 5. Positive number before normalization:

#### 2.869_{(10) } =

#### 10.1101 1110 0111 0110 1100 1000_{(2) }

### 6. Normalize the binary representation of the number.

#### Shift the decimal mark 1 positions to the left, so that only one non zero digit remains to the left of it:

#### 2.869_{(10) }=

#### 10.1101 1110 0111 0110 1100 1000_{(2) }=

#### 10.1101 1110 0111 0110 1100 1000_{(2) } × 2^{0 }=

#### 1.0110 1111 0011 1011 0110 0100 0_{(2) } × 2^{1 }

### 7. Up to this moment, there are the following elements that would feed into the 32 bit single precision IEEE 754 binary floating point representation:

#### Sign 0 (a positive number)

#### Exponent (unadjusted): 1

#### Mantissa (not normalized):

1.0110 1111 0011 1011 0110 0100 0

### 8. Adjust the exponent.

#### Use the 8 bit excess/bias notation:

#### Exponent (adjusted) =

#### Exponent (unadjusted) + 2^{(8-1)} - 1 =

#### 1 + 2^{(8-1)} - 1 =

#### (1 + 127)_{(10) } =

#### 128_{(10) }

### 9. Convert the adjusted exponent from the decimal (base 10) to 8 bit binary.

#### Use the same technique of repeatedly dividing by 2:

- division = quotient +
**remainder**; - 128 ÷ 2 = 64 +
**0**; - 64 ÷ 2 = 32 +
**0**; - 32 ÷ 2 = 16 +
**0**; - 16 ÷ 2 = 8 +
**0**; - 8 ÷ 2 = 4 +
**0**; - 4 ÷ 2 = 2 +
**0**; - 2 ÷ 2 = 1 +
**0**; - 1 ÷ 2 = 0 +
**1**;