# 64bit IEEE 754: Decimal ↗ Double Precision Floating Point Binary: 11 111 111 111 111 111 111 111 111 111 111 129 Convert the Number to 64 Bit Double Precision IEEE 754 Binary Floating Point Representation Standard, From a Base Ten Decimal System Number

## Number 11 111 111 111 111 111 111 111 111 111 111 129(10) converted and written in 64 bit double precision IEEE 754 binary floating point representation (1 bit for sign, 11 bits for exponent, 52 bits for mantissa)

### 1. Divide the number repeatedly by 2.

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

• division = quotient + remainder;
• 11 111 111 111 111 111 111 111 111 111 111 129 ÷ 2 = 5 555 555 555 555 555 555 555 555 555 555 564 + 1;
• 5 555 555 555 555 555 555 555 555 555 555 564 ÷ 2 = 2 777 777 777 777 777 777 777 777 777 777 782 + 0;
• 2 777 777 777 777 777 777 777 777 777 777 782 ÷ 2 = 1 388 888 888 888 888 888 888 888 888 888 891 + 0;
• 1 388 888 888 888 888 888 888 888 888 888 891 ÷ 2 = 694 444 444 444 444 444 444 444 444 444 445 + 1;
• 694 444 444 444 444 444 444 444 444 444 445 ÷ 2 = 347 222 222 222 222 222 222 222 222 222 222 + 1;
• 347 222 222 222 222 222 222 222 222 222 222 ÷ 2 = 173 611 111 111 111 111 111 111 111 111 111 + 0;
• 173 611 111 111 111 111 111 111 111 111 111 ÷ 2 = 86 805 555 555 555 555 555 555 555 555 555 + 1;
• 86 805 555 555 555 555 555 555 555 555 555 ÷ 2 = 43 402 777 777 777 777 777 777 777 777 777 + 1;
• 43 402 777 777 777 777 777 777 777 777 777 ÷ 2 = 21 701 388 888 888 888 888 888 888 888 888 + 1;
• 21 701 388 888 888 888 888 888 888 888 888 ÷ 2 = 10 850 694 444 444 444 444 444 444 444 444 + 0;
• 10 850 694 444 444 444 444 444 444 444 444 ÷ 2 = 5 425 347 222 222 222 222 222 222 222 222 + 0;
• 5 425 347 222 222 222 222 222 222 222 222 ÷ 2 = 2 712 673 611 111 111 111 111 111 111 111 + 0;
• 2 712 673 611 111 111 111 111 111 111 111 ÷ 2 = 1 356 336 805 555 555 555 555 555 555 555 + 1;
• 1 356 336 805 555 555 555 555 555 555 555 ÷ 2 = 678 168 402 777 777 777 777 777 777 777 + 1;
• 678 168 402 777 777 777 777 777 777 777 ÷ 2 = 339 084 201 388 888 888 888 888 888 888 + 1;
• 339 084 201 388 888 888 888 888 888 888 ÷ 2 = 169 542 100 694 444 444 444 444 444 444 + 0;
• 169 542 100 694 444 444 444 444 444 444 ÷ 2 = 84 771 050 347 222 222 222 222 222 222 + 0;
• 84 771 050 347 222 222 222 222 222 222 ÷ 2 = 42 385 525 173 611 111 111 111 111 111 + 0;
• 42 385 525 173 611 111 111 111 111 111 ÷ 2 = 21 192 762 586 805 555 555 555 555 555 + 1;
• 21 192 762 586 805 555 555 555 555 555 ÷ 2 = 10 596 381 293 402 777 777 777 777 777 + 1;
• 10 596 381 293 402 777 777 777 777 777 ÷ 2 = 5 298 190 646 701 388 888 888 888 888 + 1;
• 5 298 190 646 701 388 888 888 888 888 ÷ 2 = 2 649 095 323 350 694 444 444 444 444 + 0;
• 2 649 095 323 350 694 444 444 444 444 ÷ 2 = 1 324 547 661 675 347 222 222 222 222 + 0;
• 1 324 547 661 675 347 222 222 222 222 ÷ 2 = 662 273 830 837 673 611 111 111 111 + 0;
• 662 273 830 837 673 611 111 111 111 ÷ 2 = 331 136 915 418 836 805 555 555 555 + 1;
• 331 136 915 418 836 805 555 555 555 ÷ 2 = 165 568 457 709 418 402 777 777 777 + 1;
• 165 568 457 709 418 402 777 777 777 ÷ 2 = 82 784 228 854 709 201 388 888 888 + 1;
• 82 784 228 854 709 201 388 888 888 ÷ 2 = 41 392 114 427 354 600 694 444 444 + 0;
• 41 392 114 427 354 600 694 444 444 ÷ 2 = 20 696 057 213 677 300 347 222 222 + 0;
• 20 696 057 213 677 300 347 222 222 ÷ 2 = 10 348 028 606 838 650 173 611 111 + 0;
• 10 348 028 606 838 650 173 611 111 ÷ 2 = 5 174 014 303 419 325 086 805 555 + 1;
• 5 174 014 303 419 325 086 805 555 ÷ 2 = 2 587 007 151 709 662 543 402 777 + 1;
• 2 587 007 151 709 662 543 402 777 ÷ 2 = 1 293 503 575 854 831 271 701 388 + 1;
• 1 293 503 575 854 831 271 701 388 ÷ 2 = 646 751 787 927 415 635 850 694 + 0;
• 646 751 787 927 415 635 850 694 ÷ 2 = 323 375 893 963 707 817 925 347 + 0;
• 323 375 893 963 707 817 925 347 ÷ 2 = 161 687 946 981 853 908 962 673 + 1;
• 161 687 946 981 853 908 962 673 ÷ 2 = 80 843 973 490 926 954 481 336 + 1;
• 80 843 973 490 926 954 481 336 ÷ 2 = 40 421 986 745 463 477 240 668 + 0;
• 40 421 986 745 463 477 240 668 ÷ 2 = 20 210 993 372 731 738 620 334 + 0;
• 20 210 993 372 731 738 620 334 ÷ 2 = 10 105 496 686 365 869 310 167 + 0;
• 10 105 496 686 365 869 310 167 ÷ 2 = 5 052 748 343 182 934 655 083 + 1;
• 5 052 748 343 182 934 655 083 ÷ 2 = 2 526 374 171 591 467 327 541 + 1;
• 2 526 374 171 591 467 327 541 ÷ 2 = 1 263 187 085 795 733 663 770 + 1;
• 1 263 187 085 795 733 663 770 ÷ 2 = 631 593 542 897 866 831 885 + 0;
• 631 593 542 897 866 831 885 ÷ 2 = 315 796 771 448 933 415 942 + 1;
• 315 796 771 448 933 415 942 ÷ 2 = 157 898 385 724 466 707 971 + 0;
• 157 898 385 724 466 707 971 ÷ 2 = 78 949 192 862 233 353 985 + 1;
• 78 949 192 862 233 353 985 ÷ 2 = 39 474 596 431 116 676 992 + 1;
• 39 474 596 431 116 676 992 ÷ 2 = 19 737 298 215 558 338 496 + 0;
• 19 737 298 215 558 338 496 ÷ 2 = 9 868 649 107 779 169 248 + 0;
• 9 868 649 107 779 169 248 ÷ 2 = 4 934 324 553 889 584 624 + 0;
• 4 934 324 553 889 584 624 ÷ 2 = 2 467 162 276 944 792 312 + 0;
• 2 467 162 276 944 792 312 ÷ 2 = 1 233 581 138 472 396 156 + 0;
• 1 233 581 138 472 396 156 ÷ 2 = 616 790 569 236 198 078 + 0;
• 616 790 569 236 198 078 ÷ 2 = 308 395 284 618 099 039 + 0;
• 308 395 284 618 099 039 ÷ 2 = 154 197 642 309 049 519 + 1;
• 154 197 642 309 049 519 ÷ 2 = 77 098 821 154 524 759 + 1;
• 77 098 821 154 524 759 ÷ 2 = 38 549 410 577 262 379 + 1;
• 38 549 410 577 262 379 ÷ 2 = 19 274 705 288 631 189 + 1;
• 19 274 705 288 631 189 ÷ 2 = 9 637 352 644 315 594 + 1;
• 9 637 352 644 315 594 ÷ 2 = 4 818 676 322 157 797 + 0;
• 4 818 676 322 157 797 ÷ 2 = 2 409 338 161 078 898 + 1;
• 2 409 338 161 078 898 ÷ 2 = 1 204 669 080 539 449 + 0;
• 1 204 669 080 539 449 ÷ 2 = 602 334 540 269 724 + 1;
• 602 334 540 269 724 ÷ 2 = 301 167 270 134 862 + 0;
• 301 167 270 134 862 ÷ 2 = 150 583 635 067 431 + 0;
• 150 583 635 067 431 ÷ 2 = 75 291 817 533 715 + 1;
• 75 291 817 533 715 ÷ 2 = 37 645 908 766 857 + 1;
• 37 645 908 766 857 ÷ 2 = 18 822 954 383 428 + 1;
• 18 822 954 383 428 ÷ 2 = 9 411 477 191 714 + 0;
• 9 411 477 191 714 ÷ 2 = 4 705 738 595 857 + 0;
• 4 705 738 595 857 ÷ 2 = 2 352 869 297 928 + 1;
• 2 352 869 297 928 ÷ 2 = 1 176 434 648 964 + 0;
• 1 176 434 648 964 ÷ 2 = 588 217 324 482 + 0;
• 588 217 324 482 ÷ 2 = 294 108 662 241 + 0;
• 294 108 662 241 ÷ 2 = 147 054 331 120 + 1;
• 147 054 331 120 ÷ 2 = 73 527 165 560 + 0;
• 73 527 165 560 ÷ 2 = 36 763 582 780 + 0;
• 36 763 582 780 ÷ 2 = 18 381 791 390 + 0;
• 18 381 791 390 ÷ 2 = 9 190 895 695 + 0;
• 9 190 895 695 ÷ 2 = 4 595 447 847 + 1;
• 4 595 447 847 ÷ 2 = 2 297 723 923 + 1;
• 2 297 723 923 ÷ 2 = 1 148 861 961 + 1;
• 1 148 861 961 ÷ 2 = 574 430 980 + 1;
• 574 430 980 ÷ 2 = 287 215 490 + 0;
• 287 215 490 ÷ 2 = 143 607 745 + 0;
• 143 607 745 ÷ 2 = 71 803 872 + 1;
• 71 803 872 ÷ 2 = 35 901 936 + 0;
• 35 901 936 ÷ 2 = 17 950 968 + 0;
• 17 950 968 ÷ 2 = 8 975 484 + 0;
• 8 975 484 ÷ 2 = 4 487 742 + 0;
• 4 487 742 ÷ 2 = 2 243 871 + 0;
• 2 243 871 ÷ 2 = 1 121 935 + 1;
• 1 121 935 ÷ 2 = 560 967 + 1;
• 560 967 ÷ 2 = 280 483 + 1;
• 280 483 ÷ 2 = 140 241 + 1;
• 140 241 ÷ 2 = 70 120 + 1;
• 70 120 ÷ 2 = 35 060 + 0;
• 35 060 ÷ 2 = 17 530 + 0;
• 17 530 ÷ 2 = 8 765 + 0;
• 8 765 ÷ 2 = 4 382 + 1;
• 4 382 ÷ 2 = 2 191 + 0;
• 2 191 ÷ 2 = 1 095 + 1;
• 1 095 ÷ 2 = 547 + 1;
• 547 ÷ 2 = 273 + 1;
• 273 ÷ 2 = 136 + 1;
• 136 ÷ 2 = 68 + 0;
• 68 ÷ 2 = 34 + 0;
• 34 ÷ 2 = 17 + 0;
• 17 ÷ 2 = 8 + 1;
• 8 ÷ 2 = 4 + 0;
• 4 ÷ 2 = 2 + 0;
• 2 ÷ 2 = 1 + 0;
• 1 ÷ 2 = 0 + 1;

### 6. Convert the adjusted exponent from the decimal (base 10) to 11 bit binary.

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

• division = quotient + remainder;
• 1 136 ÷ 2 = 568 + 0;
• 568 ÷ 2 = 284 + 0;
• 284 ÷ 2 = 142 + 0;
• 142 ÷ 2 = 71 + 0;
• 71 ÷ 2 = 35 + 1;
• 35 ÷ 2 = 17 + 1;
• 17 ÷ 2 = 8 + 1;
• 8 ÷ 2 = 4 + 0;
• 4 ÷ 2 = 2 + 0;
• 2 ÷ 2 = 1 + 0;
• 1 ÷ 2 = 0 + 1;

## How to convert numbers from the decimal system (base ten) to 64 bit double precision IEEE 754 binary floating point standard

### Follow the steps below to convert a base 10 decimal number to 64 bit double precision IEEE 754 binary floating point:

• 1. If the number to be converted is negative, start with its the positive version.
• 2. First convert the integer part. Divide repeatedly by 2 the positive representation of the integer number that is to be converted to binary, until we get a quotient that is equal to zero, keeping track of each remainder.
• 3. Construct the base 2 representation of the positive integer part of the number, by taking all the remainders from the previous operations, starting from the bottom of the list constructed above. Thus, the last remainder of the divisions becomes the first symbol (the leftmost) of the base two number, while the first remainder becomes the last symbol (the rightmost).
• 4. Then convert the fractional part. Multiply the number repeatedly by 2, until we get a fractional part that is equal to zero, keeping track of each integer part of the results.
• 5. Construct the base 2 representation of the fractional part of the number, by taking all the integer parts of the multiplying operations, starting from the top of the list constructed above (they should appear in the binary representation, from left to right, in the order they have been calculated).
• 6. Normalize the binary representation of the number, shifting the decimal mark (the decimal point) "n" positions either to the left, or to the right, so that only one non zero digit remains to the left of the decimal mark.
• 7. Adjust the exponent in 11 bit excess/bias notation and then convert it from decimal (base 10) to 11 bit binary, by using the same technique of repeatedly dividing by 2, as shown above:
• 8. Normalize mantissa, remove the leading (leftmost) bit, since it's allways '1' (and the decimal mark, if the case) and adjust its length to 52 bits, either by removing the excess bits from the right (losing precision...) or by adding extra bits set on '0' to the right.
• 9. Sign (it takes 1 bit) is either 1 for a negative or 0 for a positive number.

### Example: convert the negative number -31.640 215 from the decimal system (base ten) to 64 bit double precision IEEE 754 binary floating point:

|-31.640 215| = 31.640 215

• 2. First convert the integer part, 31. Divide it repeatedly by 2, keeping track of each remainder, until we get a quotient that is equal to zero:
• division = quotient + remainder;
• 31 ÷ 2 = 15 + 1;
• 15 ÷ 2 = 7 + 1;
• 7 ÷ 2 = 3 + 1;
• 3 ÷ 2 = 1 + 1;
• 1 ÷ 2 = 0 + 1;
• We have encountered a quotient that is ZERO => FULL STOP
• 3. Construct the base 2 representation of the integer part of the number by taking all the remainders of the previous dividing operations, starting from the bottom of the list constructed above:

31(10) = 1 1111(2)

• 4. Then, convert the fractional part, 0.640 215. Multiply repeatedly by 2, keeping track of each integer part of the results, until we get a fractional part that is equal to zero:
• #) multiplying = integer + fractional part;
• 1) 0.640 215 × 2 = 1 + 0.280 43;
• 2) 0.280 43 × 2 = 0 + 0.560 86;
• 3) 0.560 86 × 2 = 1 + 0.121 72;
• 4) 0.121 72 × 2 = 0 + 0.243 44;
• 5) 0.243 44 × 2 = 0 + 0.486 88;
• 6) 0.486 88 × 2 = 0 + 0.973 76;
• 7) 0.973 76 × 2 = 1 + 0.947 52;
• 8) 0.947 52 × 2 = 1 + 0.895 04;
• 9) 0.895 04 × 2 = 1 + 0.790 08;
• 10) 0.790 08 × 2 = 1 + 0.580 16;
• 11) 0.580 16 × 2 = 1 + 0.160 32;
• 12) 0.160 32 × 2 = 0 + 0.320 64;
• 13) 0.320 64 × 2 = 0 + 0.641 28;
• 14) 0.641 28 × 2 = 1 + 0.282 56;
• 15) 0.282 56 × 2 = 0 + 0.565 12;
• 16) 0.565 12 × 2 = 1 + 0.130 24;
• 17) 0.130 24 × 2 = 0 + 0.260 48;
• 18) 0.260 48 × 2 = 0 + 0.520 96;
• 19) 0.520 96 × 2 = 1 + 0.041 92;
• 20) 0.041 92 × 2 = 0 + 0.083 84;
• 21) 0.083 84 × 2 = 0 + 0.167 68;
• 22) 0.167 68 × 2 = 0 + 0.335 36;
• 23) 0.335 36 × 2 = 0 + 0.670 72;
• 24) 0.670 72 × 2 = 1 + 0.341 44;
• 25) 0.341 44 × 2 = 0 + 0.682 88;
• 26) 0.682 88 × 2 = 1 + 0.365 76;
• 27) 0.365 76 × 2 = 0 + 0.731 52;
• 28) 0.731 52 × 2 = 1 + 0.463 04;
• 29) 0.463 04 × 2 = 0 + 0.926 08;
• 30) 0.926 08 × 2 = 1 + 0.852 16;
• 31) 0.852 16 × 2 = 1 + 0.704 32;
• 32) 0.704 32 × 2 = 1 + 0.408 64;
• 33) 0.408 64 × 2 = 0 + 0.817 28;
• 34) 0.817 28 × 2 = 1 + 0.634 56;
• 35) 0.634 56 × 2 = 1 + 0.269 12;
• 36) 0.269 12 × 2 = 0 + 0.538 24;
• 37) 0.538 24 × 2 = 1 + 0.076 48;
• 38) 0.076 48 × 2 = 0 + 0.152 96;
• 39) 0.152 96 × 2 = 0 + 0.305 92;
• 40) 0.305 92 × 2 = 0 + 0.611 84;
• 41) 0.611 84 × 2 = 1 + 0.223 68;
• 42) 0.223 68 × 2 = 0 + 0.447 36;
• 43) 0.447 36 × 2 = 0 + 0.894 72;
• 44) 0.894 72 × 2 = 1 + 0.789 44;
• 45) 0.789 44 × 2 = 1 + 0.578 88;
• 46) 0.578 88 × 2 = 1 + 0.157 76;
• 47) 0.157 76 × 2 = 0 + 0.315 52;
• 48) 0.315 52 × 2 = 0 + 0.631 04;
• 49) 0.631 04 × 2 = 1 + 0.262 08;
• 50) 0.262 08 × 2 = 0 + 0.524 16;
• 51) 0.524 16 × 2 = 1 + 0.048 32;
• 52) 0.048 32 × 2 = 0 + 0.096 64;
• 53) 0.096 64 × 2 = 0 + 0.193 28;
• We didn't get any fractional part that was equal to zero. But we had enough iterations (over Mantissa limit = 52) and at least one integer part that was different from zero => FULL STOP (losing precision...).
• 5. Construct the base 2 representation of the fractional part of the number, by taking all the integer parts of the previous multiplying operations, starting from the top of the constructed list above:

0.640 215(10) = 0.1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100 1010 0(2)

• 6. Summarizing - the positive number before normalization:

31.640 215(10) = 1 1111.1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100 1010 0(2)

• 7. Normalize the binary representation of the number, shifting the decimal mark 4 positions to the left so that only one non-zero digit stays to the left of the decimal mark:

31.640 215(10) =
1 1111.1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100 1010 0(2) =
1 1111.1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100 1010 0(2) × 20 =
1.1111 1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100 1010 0(2) × 24

• 8. Up to this moment, there are the following elements that would feed into the 64 bit double precision IEEE 754 binary floating point representation:

Sign: 1 (a negative number)

Mantissa (not-normalized): 1.1111 1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100 1010 0

• 9. Adjust the exponent in 11 bit excess/bias notation and then convert it from decimal (base 10) to 11 bit binary (base 2), by using the same technique of repeatedly dividing it by 2, as shown above:

Exponent (adjusted) = Exponent (unadjusted) + 2(11-1) - 1 = (4 + 1023)(10) = 1027(10) =
100 0000 0011(2)

• 10. Normalize mantissa, remove the leading (leftmost) bit, since it's allways '1' (and the decimal sign) and adjust its length to 52 bits, by removing the excess bits, from the right (losing precision...):

Mantissa (not-normalized): 1.1111 1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100 1010 0

Mantissa (normalized): 1111 1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100

• Conclusion:

Sign (1 bit) = 1 (a negative number)

Exponent (8 bits) = 100 0000 0011

Mantissa (52 bits) = 1111 1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100

• Number -31.640 215, converted from decimal system (base 10) to 64 bit double precision IEEE 754 binary floating point =
1 - 100 0000 0011 - 1111 1010 0011 1110 0101 0010 0001 0101 0111 0110 1000 1001 1100