Convert −9.125 to IEEE 754 Single and Double Precision Step by Step
To convert the decimal number −9.125 into its IEEE 754 double-precision(64) and single-precision (32-bit) representation, we’ll follow these steps:
✅ Step-by-Step Conversion of −9.125 to IEEE 754 (64-bit)
a) Normalization of the Binary Number
-
Convert the absolute value of the number (9.125) to binary:
-
9 in binary =
1001 -
0.125 in binary:
-
0.125 × 2 = 0.25 →
0 -
0.25 × 2 = 0.5 →
0 -
0.5 × 2 = 1.0 →
1
→ So, 0.125 =0.001
-
✅ Therefore,
9.125 in binary = 1001.001
-
Normalize it (move the binary point after the first 1):
1001.001 → 1.001001 × 2³
✅ So, the normalized binary form is:
1.001001 × 2³
b) Determination of the Sign Bit, Exponent, and Mantissa
1. Sign Bit (s):
-
The number is negative → sign bit =
1
✅ s = 1
2. Exponent (e):
IEEE 754 double-precision uses:
-
11 bits for exponent
-
Bias = 1023
Since exponent = 3 (from 1.001001 × 2³):
e = 3 + 1023 = 1026
Convert 1026 to binary:
-
1026 =
10000000010(11 bits)
✅ Exponent = 10000000010
3. Mantissa (Fraction):
-
From the normalized form
1.001001, the fraction part is everything after the decimal point:001001 -
Fill with zeros to make it 52 bits:
0010010000000000000000000000000000000000000000000000
✅ Mantissa = 001001 followed by 46 zeros
✅ Final IEEE 754 Double-Precision Representation
Put all parts together:
| Sign (1 bit) | Exponent (11 bits) | Mantissa (52 bits) |
|---|---|---|
| 1 | 10000000010 | 0010010000000000000000000000000000000000000000000000 |
here’s −9.125 in IEEE 754 single-precision (32-bit) too.
a) Normalization (same as before)
b) Sign, exponent, mantissa (single precision)
-
Sign bit (1 bit): number is negative →
1 -
Exponent (8 bits): bias = 127 → →
10000010 -
Mantissa (23 bits): fraction after the leading 1 ⇒
001001then pad zeros to 23 bits
→00100100000000000000000
Final 32-bit pattern
1 10000010 00100100000000000000000
No comments