Перевод из десятичной системы в double ieee-754 (черновая версия)
Введите число в десятичной записи. | ||
+ | 0 | . | 875 | * 10^0 |
Учитываем порядок
С учетом порядка: x = + 0.875
Нормализация
Нормализуем мантиссу (приведем к виду 1.xxx...x * 2^exp)
Шаг | Мантисса | * 2^двоичный порядок |
0 | 0.875 | * 2^0 |
1 | 1.75 | * 2^-1 |
x = +1.75 * 2^-1
Перевод в двоичный вид
Переводим нормализованную мантиссу в двоичный вид (p = 52)
Шаг i | Двоичная мантисса | остаток * 2^-i |
0 | 1. | + 0.75 * 2^-0 |
1 | 1.1 | + 0.5 * 2^-1 |
2 | 1.11 | + 0.0 * 2^-2 |
3 | 1.110 | + 0.0 * 2^-3 |
4 | 1.1100 | + 0.0 * 2^-4 |
5 | 1.11000 | + 0.0 * 2^-5 |
6 | 1.110000 | + 0.0 * 2^-6 |
7 | 1.1100000 | + 0.0 * 2^-7 |
8 | 1.11000000 | + 0.0 * 2^-8 |
9 | 1.110000000 | + 0.0 * 2^-9 |
10 | 1.1100000000 | + 0.0 * 2^-10 |
11 | 1.11000000000 | + 0.0 * 2^-11 |
12 | 1.110000000000 | + 0.0 * 2^-12 |
13 | 1.1100000000000 | + 0.0 * 2^-13 |
14 | 1.11000000000000 | + 0.0 * 2^-14 |
15 | 1.110000000000000 | + 0.0 * 2^-15 |
16 | 1.1100000000000000 | + 0.0 * 2^-16 |
17 | 1.11000000000000000 | + 0.0 * 2^-17 |
18 | 1.110000000000000000 | + 0.0 * 2^-18 |
19 | 1.1100000000000000000 | + 0.0 * 2^-19 |
20 | 1.11000000000000000000 | + 0.0 * 2^-20 |
21 | 1.110000000000000000000 | + 0.0 * 2^-21 |
22 | 1.1100000000000000000000 | + 0.0 * 2^-22 |
23 | 1.11000000000000000000000 | + 0.0 * 2^-23 |
24 | 1.110000000000000000000000 | + 0.0 * 2^-24 |
25 | 1.1100000000000000000000000 | + 0.0 * 2^-25 |
26 | 1.11000000000000000000000000 | + 0.0 * 2^-26 |
27 | 1.110000000000000000000000000 | + 0.0 * 2^-27 |
28 | 1.1100000000000000000000000000 | + 0.0 * 2^-28 |
29 | 1.11000000000000000000000000000 | + 0.0 * 2^-29 |
30 | 1.110000000000000000000000000000 | + 0.0 * 2^-30 |
31 | 1.1100000000000000000000000000000 | + 0.0 * 2^-31 |
32 | 1.11000000000000000000000000000000 | + 0.0 * 2^-32 |
33 | 1.110000000000000000000000000000000 | + 0.0 * 2^-33 |
34 | 1.1100000000000000000000000000000000 | + 0.0 * 2^-34 |
35 | 1.11000000000000000000000000000000000 | + 0.0 * 2^-35 |
36 | 1.110000000000000000000000000000000000 | + 0.0 * 2^-36 |
37 | 1.1100000000000000000000000000000000000 | + 0.0 * 2^-37 |
38 | 1.11000000000000000000000000000000000000 | + 0.0 * 2^-38 |
39 | 1.110000000000000000000000000000000000000 | + 0.0 * 2^-39 |
40 | 1.1100000000000000000000000000000000000000 | + 0.0 * 2^-40 |
41 | 1.11000000000000000000000000000000000000000 | + 0.0 * 2^-41 |
42 | 1.110000000000000000000000000000000000000000 | + 0.0 * 2^-42 |
43 | 1.1100000000000000000000000000000000000000000 | + 0.0 * 2^-43 |
44 | 1.11000000000000000000000000000000000000000000 | + 0.0 * 2^-44 |
45 | 1.110000000000000000000000000000000000000000000 | + 0.0 * 2^-45 |
46 | 1.1100000000000000000000000000000000000000000000 | + 0.0 * 2^-46 |
47 | 1.11000000000000000000000000000000000000000000000 | + 0.0 * 2^-47 |
48 | 1.110000000000000000000000000000000000000000000000 | + 0.0 * 2^-48 |
49 | 1.1100000000000000000000000000000000000000000000000 | + 0.0 * 2^-49 |
50 | 1.11000000000000000000000000000000000000000000000000 | + 0.0 * 2^-50 |
51 | 1.110000000000000000000000000000000000000000000000000 | + 0.0 * 2^-51 |
52 | 1.1100000000000000000000000000000000000000000000000000 | + 0.0 * 2^-52 |
Округление (ieee-754)
Шаг | Мантисса | Бит p + 1 (=53) | Остаток (sticky) |
53 | 1.1100000000000000000000000000000000000000000000000000 | 0 | 0.0 * 2^-53 |
Результат
Экспонента со смещением: -1 + 1023 = 1022
Знак | Смещенный порядок (e + 1023) | Дробная часть мантиссы |
0 | 01111111110 | 1100000000000000000000000000000000000000000000000000 |
x = 0x3fec000000000000