1.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336 Converted to 64 Bit Double Precision IEEE 754 Binary Floating Point Representation Standard

Convert decimal 1.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336(10) to 64 bit double precision IEEE 754 binary floating point representation standard (1 bit for sign, 11 bits for exponent, 52 bits for mantissa)

What are the steps to convert decimal number
1.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336(10) to 64 bit double precision IEEE 754 binary floating point representation (1 bit for sign, 11 bits for exponent, 52 bits for mantissa)

1. First, convert to binary (in base 2) the integer part: 1.
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;
  • 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.

1(10) =


1(2)


3. Convert to binary (base 2) the fractional part: 0.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336.

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.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336 × 2 = 0 + 0.828 427 124 746 190 097 603 377 448 419 396 157 139 343 750 753 896 146 353 359 475 981 464 956 924 214 077 700 775 068 654 672;
  • 2) 0.828 427 124 746 190 097 603 377 448 419 396 157 139 343 750 753 896 146 353 359 475 981 464 956 924 214 077 700 775 068 654 672 × 2 = 1 + 0.656 854 249 492 380 195 206 754 896 838 792 314 278 687 501 507 792 292 706 718 951 962 929 913 848 428 155 401 550 137 309 344;
  • 3) 0.656 854 249 492 380 195 206 754 896 838 792 314 278 687 501 507 792 292 706 718 951 962 929 913 848 428 155 401 550 137 309 344 × 2 = 1 + 0.313 708 498 984 760 390 413 509 793 677 584 628 557 375 003 015 584 585 413 437 903 925 859 827 696 856 310 803 100 274 618 688;
  • 4) 0.313 708 498 984 760 390 413 509 793 677 584 628 557 375 003 015 584 585 413 437 903 925 859 827 696 856 310 803 100 274 618 688 × 2 = 0 + 0.627 416 997 969 520 780 827 019 587 355 169 257 114 750 006 031 169 170 826 875 807 851 719 655 393 712 621 606 200 549 237 376;
  • 5) 0.627 416 997 969 520 780 827 019 587 355 169 257 114 750 006 031 169 170 826 875 807 851 719 655 393 712 621 606 200 549 237 376 × 2 = 1 + 0.254 833 995 939 041 561 654 039 174 710 338 514 229 500 012 062 338 341 653 751 615 703 439 310 787 425 243 212 401 098 474 752;
  • 6) 0.254 833 995 939 041 561 654 039 174 710 338 514 229 500 012 062 338 341 653 751 615 703 439 310 787 425 243 212 401 098 474 752 × 2 = 0 + 0.509 667 991 878 083 123 308 078 349 420 677 028 459 000 024 124 676 683 307 503 231 406 878 621 574 850 486 424 802 196 949 504;
  • 7) 0.509 667 991 878 083 123 308 078 349 420 677 028 459 000 024 124 676 683 307 503 231 406 878 621 574 850 486 424 802 196 949 504 × 2 = 1 + 0.019 335 983 756 166 246 616 156 698 841 354 056 918 000 048 249 353 366 615 006 462 813 757 243 149 700 972 849 604 393 899 008;
  • 8) 0.019 335 983 756 166 246 616 156 698 841 354 056 918 000 048 249 353 366 615 006 462 813 757 243 149 700 972 849 604 393 899 008 × 2 = 0 + 0.038 671 967 512 332 493 232 313 397 682 708 113 836 000 096 498 706 733 230 012 925 627 514 486 299 401 945 699 208 787 798 016;
  • 9) 0.038 671 967 512 332 493 232 313 397 682 708 113 836 000 096 498 706 733 230 012 925 627 514 486 299 401 945 699 208 787 798 016 × 2 = 0 + 0.077 343 935 024 664 986 464 626 795 365 416 227 672 000 192 997 413 466 460 025 851 255 028 972 598 803 891 398 417 575 596 032;
  • 10) 0.077 343 935 024 664 986 464 626 795 365 416 227 672 000 192 997 413 466 460 025 851 255 028 972 598 803 891 398 417 575 596 032 × 2 = 0 + 0.154 687 870 049 329 972 929 253 590 730 832 455 344 000 385 994 826 932 920 051 702 510 057 945 197 607 782 796 835 151 192 064;
  • 11) 0.154 687 870 049 329 972 929 253 590 730 832 455 344 000 385 994 826 932 920 051 702 510 057 945 197 607 782 796 835 151 192 064 × 2 = 0 + 0.309 375 740 098 659 945 858 507 181 461 664 910 688 000 771 989 653 865 840 103 405 020 115 890 395 215 565 593 670 302 384 128;
  • 12) 0.309 375 740 098 659 945 858 507 181 461 664 910 688 000 771 989 653 865 840 103 405 020 115 890 395 215 565 593 670 302 384 128 × 2 = 0 + 0.618 751 480 197 319 891 717 014 362 923 329 821 376 001 543 979 307 731 680 206 810 040 231 780 790 431 131 187 340 604 768 256;
  • 13) 0.618 751 480 197 319 891 717 014 362 923 329 821 376 001 543 979 307 731 680 206 810 040 231 780 790 431 131 187 340 604 768 256 × 2 = 1 + 0.237 502 960 394 639 783 434 028 725 846 659 642 752 003 087 958 615 463 360 413 620 080 463 561 580 862 262 374 681 209 536 512;
  • 14) 0.237 502 960 394 639 783 434 028 725 846 659 642 752 003 087 958 615 463 360 413 620 080 463 561 580 862 262 374 681 209 536 512 × 2 = 0 + 0.475 005 920 789 279 566 868 057 451 693 319 285 504 006 175 917 230 926 720 827 240 160 927 123 161 724 524 749 362 419 073 024;
  • 15) 0.475 005 920 789 279 566 868 057 451 693 319 285 504 006 175 917 230 926 720 827 240 160 927 123 161 724 524 749 362 419 073 024 × 2 = 0 + 0.950 011 841 578 559 133 736 114 903 386 638 571 008 012 351 834 461 853 441 654 480 321 854 246 323 449 049 498 724 838 146 048;
  • 16) 0.950 011 841 578 559 133 736 114 903 386 638 571 008 012 351 834 461 853 441 654 480 321 854 246 323 449 049 498 724 838 146 048 × 2 = 1 + 0.900 023 683 157 118 267 472 229 806 773 277 142 016 024 703 668 923 706 883 308 960 643 708 492 646 898 098 997 449 676 292 096;
  • 17) 0.900 023 683 157 118 267 472 229 806 773 277 142 016 024 703 668 923 706 883 308 960 643 708 492 646 898 098 997 449 676 292 096 × 2 = 1 + 0.800 047 366 314 236 534 944 459 613 546 554 284 032 049 407 337 847 413 766 617 921 287 416 985 293 796 197 994 899 352 584 192;
  • 18) 0.800 047 366 314 236 534 944 459 613 546 554 284 032 049 407 337 847 413 766 617 921 287 416 985 293 796 197 994 899 352 584 192 × 2 = 1 + 0.600 094 732 628 473 069 888 919 227 093 108 568 064 098 814 675 694 827 533 235 842 574 833 970 587 592 395 989 798 705 168 384;
  • 19) 0.600 094 732 628 473 069 888 919 227 093 108 568 064 098 814 675 694 827 533 235 842 574 833 970 587 592 395 989 798 705 168 384 × 2 = 1 + 0.200 189 465 256 946 139 777 838 454 186 217 136 128 197 629 351 389 655 066 471 685 149 667 941 175 184 791 979 597 410 336 768;
  • 20) 0.200 189 465 256 946 139 777 838 454 186 217 136 128 197 629 351 389 655 066 471 685 149 667 941 175 184 791 979 597 410 336 768 × 2 = 0 + 0.400 378 930 513 892 279 555 676 908 372 434 272 256 395 258 702 779 310 132 943 370 299 335 882 350 369 583 959 194 820 673 536;
  • 21) 0.400 378 930 513 892 279 555 676 908 372 434 272 256 395 258 702 779 310 132 943 370 299 335 882 350 369 583 959 194 820 673 536 × 2 = 0 + 0.800 757 861 027 784 559 111 353 816 744 868 544 512 790 517 405 558 620 265 886 740 598 671 764 700 739 167 918 389 641 347 072;
  • 22) 0.800 757 861 027 784 559 111 353 816 744 868 544 512 790 517 405 558 620 265 886 740 598 671 764 700 739 167 918 389 641 347 072 × 2 = 1 + 0.601 515 722 055 569 118 222 707 633 489 737 089 025 581 034 811 117 240 531 773 481 197 343 529 401 478 335 836 779 282 694 144;
  • 23) 0.601 515 722 055 569 118 222 707 633 489 737 089 025 581 034 811 117 240 531 773 481 197 343 529 401 478 335 836 779 282 694 144 × 2 = 1 + 0.203 031 444 111 138 236 445 415 266 979 474 178 051 162 069 622 234 481 063 546 962 394 687 058 802 956 671 673 558 565 388 288;
  • 24) 0.203 031 444 111 138 236 445 415 266 979 474 178 051 162 069 622 234 481 063 546 962 394 687 058 802 956 671 673 558 565 388 288 × 2 = 0 + 0.406 062 888 222 276 472 890 830 533 958 948 356 102 324 139 244 468 962 127 093 924 789 374 117 605 913 343 347 117 130 776 576;
  • 25) 0.406 062 888 222 276 472 890 830 533 958 948 356 102 324 139 244 468 962 127 093 924 789 374 117 605 913 343 347 117 130 776 576 × 2 = 0 + 0.812 125 776 444 552 945 781 661 067 917 896 712 204 648 278 488 937 924 254 187 849 578 748 235 211 826 686 694 234 261 553 152;
  • 26) 0.812 125 776 444 552 945 781 661 067 917 896 712 204 648 278 488 937 924 254 187 849 578 748 235 211 826 686 694 234 261 553 152 × 2 = 1 + 0.624 251 552 889 105 891 563 322 135 835 793 424 409 296 556 977 875 848 508 375 699 157 496 470 423 653 373 388 468 523 106 304;
  • 27) 0.624 251 552 889 105 891 563 322 135 835 793 424 409 296 556 977 875 848 508 375 699 157 496 470 423 653 373 388 468 523 106 304 × 2 = 1 + 0.248 503 105 778 211 783 126 644 271 671 586 848 818 593 113 955 751 697 016 751 398 314 992 940 847 306 746 776 937 046 212 608;
  • 28) 0.248 503 105 778 211 783 126 644 271 671 586 848 818 593 113 955 751 697 016 751 398 314 992 940 847 306 746 776 937 046 212 608 × 2 = 0 + 0.497 006 211 556 423 566 253 288 543 343 173 697 637 186 227 911 503 394 033 502 796 629 985 881 694 613 493 553 874 092 425 216;
  • 29) 0.497 006 211 556 423 566 253 288 543 343 173 697 637 186 227 911 503 394 033 502 796 629 985 881 694 613 493 553 874 092 425 216 × 2 = 0 + 0.994 012 423 112 847 132 506 577 086 686 347 395 274 372 455 823 006 788 067 005 593 259 971 763 389 226 987 107 748 184 850 432;
  • 30) 0.994 012 423 112 847 132 506 577 086 686 347 395 274 372 455 823 006 788 067 005 593 259 971 763 389 226 987 107 748 184 850 432 × 2 = 1 + 0.988 024 846 225 694 265 013 154 173 372 694 790 548 744 911 646 013 576 134 011 186 519 943 526 778 453 974 215 496 369 700 864;
  • 31) 0.988 024 846 225 694 265 013 154 173 372 694 790 548 744 911 646 013 576 134 011 186 519 943 526 778 453 974 215 496 369 700 864 × 2 = 1 + 0.976 049 692 451 388 530 026 308 346 745 389 581 097 489 823 292 027 152 268 022 373 039 887 053 556 907 948 430 992 739 401 728;
  • 32) 0.976 049 692 451 388 530 026 308 346 745 389 581 097 489 823 292 027 152 268 022 373 039 887 053 556 907 948 430 992 739 401 728 × 2 = 1 + 0.952 099 384 902 777 060 052 616 693 490 779 162 194 979 646 584 054 304 536 044 746 079 774 107 113 815 896 861 985 478 803 456;
  • 33) 0.952 099 384 902 777 060 052 616 693 490 779 162 194 979 646 584 054 304 536 044 746 079 774 107 113 815 896 861 985 478 803 456 × 2 = 1 + 0.904 198 769 805 554 120 105 233 386 981 558 324 389 959 293 168 108 609 072 089 492 159 548 214 227 631 793 723 970 957 606 912;
  • 34) 0.904 198 769 805 554 120 105 233 386 981 558 324 389 959 293 168 108 609 072 089 492 159 548 214 227 631 793 723 970 957 606 912 × 2 = 1 + 0.808 397 539 611 108 240 210 466 773 963 116 648 779 918 586 336 217 218 144 178 984 319 096 428 455 263 587 447 941 915 213 824;
  • 35) 0.808 397 539 611 108 240 210 466 773 963 116 648 779 918 586 336 217 218 144 178 984 319 096 428 455 263 587 447 941 915 213 824 × 2 = 1 + 0.616 795 079 222 216 480 420 933 547 926 233 297 559 837 172 672 434 436 288 357 968 638 192 856 910 527 174 895 883 830 427 648;
  • 36) 0.616 795 079 222 216 480 420 933 547 926 233 297 559 837 172 672 434 436 288 357 968 638 192 856 910 527 174 895 883 830 427 648 × 2 = 1 + 0.233 590 158 444 432 960 841 867 095 852 466 595 119 674 345 344 868 872 576 715 937 276 385 713 821 054 349 791 767 660 855 296;
  • 37) 0.233 590 158 444 432 960 841 867 095 852 466 595 119 674 345 344 868 872 576 715 937 276 385 713 821 054 349 791 767 660 855 296 × 2 = 0 + 0.467 180 316 888 865 921 683 734 191 704 933 190 239 348 690 689 737 745 153 431 874 552 771 427 642 108 699 583 535 321 710 592;
  • 38) 0.467 180 316 888 865 921 683 734 191 704 933 190 239 348 690 689 737 745 153 431 874 552 771 427 642 108 699 583 535 321 710 592 × 2 = 0 + 0.934 360 633 777 731 843 367 468 383 409 866 380 478 697 381 379 475 490 306 863 749 105 542 855 284 217 399 167 070 643 421 184;
  • 39) 0.934 360 633 777 731 843 367 468 383 409 866 380 478 697 381 379 475 490 306 863 749 105 542 855 284 217 399 167 070 643 421 184 × 2 = 1 + 0.868 721 267 555 463 686 734 936 766 819 732 760 957 394 762 758 950 980 613 727 498 211 085 710 568 434 798 334 141 286 842 368;
  • 40) 0.868 721 267 555 463 686 734 936 766 819 732 760 957 394 762 758 950 980 613 727 498 211 085 710 568 434 798 334 141 286 842 368 × 2 = 1 + 0.737 442 535 110 927 373 469 873 533 639 465 521 914 789 525 517 901 961 227 454 996 422 171 421 136 869 596 668 282 573 684 736;
  • 41) 0.737 442 535 110 927 373 469 873 533 639 465 521 914 789 525 517 901 961 227 454 996 422 171 421 136 869 596 668 282 573 684 736 × 2 = 1 + 0.474 885 070 221 854 746 939 747 067 278 931 043 829 579 051 035 803 922 454 909 992 844 342 842 273 739 193 336 565 147 369 472;
  • 42) 0.474 885 070 221 854 746 939 747 067 278 931 043 829 579 051 035 803 922 454 909 992 844 342 842 273 739 193 336 565 147 369 472 × 2 = 0 + 0.949 770 140 443 709 493 879 494 134 557 862 087 659 158 102 071 607 844 909 819 985 688 685 684 547 478 386 673 130 294 738 944;
  • 43) 0.949 770 140 443 709 493 879 494 134 557 862 087 659 158 102 071 607 844 909 819 985 688 685 684 547 478 386 673 130 294 738 944 × 2 = 1 + 0.899 540 280 887 418 987 758 988 269 115 724 175 318 316 204 143 215 689 819 639 971 377 371 369 094 956 773 346 260 589 477 888;
  • 44) 0.899 540 280 887 418 987 758 988 269 115 724 175 318 316 204 143 215 689 819 639 971 377 371 369 094 956 773 346 260 589 477 888 × 2 = 1 + 0.799 080 561 774 837 975 517 976 538 231 448 350 636 632 408 286 431 379 639 279 942 754 742 738 189 913 546 692 521 178 955 776;
  • 45) 0.799 080 561 774 837 975 517 976 538 231 448 350 636 632 408 286 431 379 639 279 942 754 742 738 189 913 546 692 521 178 955 776 × 2 = 1 + 0.598 161 123 549 675 951 035 953 076 462 896 701 273 264 816 572 862 759 278 559 885 509 485 476 379 827 093 385 042 357 911 552;
  • 46) 0.598 161 123 549 675 951 035 953 076 462 896 701 273 264 816 572 862 759 278 559 885 509 485 476 379 827 093 385 042 357 911 552 × 2 = 1 + 0.196 322 247 099 351 902 071 906 152 925 793 402 546 529 633 145 725 518 557 119 771 018 970 952 759 654 186 770 084 715 823 104;
  • 47) 0.196 322 247 099 351 902 071 906 152 925 793 402 546 529 633 145 725 518 557 119 771 018 970 952 759 654 186 770 084 715 823 104 × 2 = 0 + 0.392 644 494 198 703 804 143 812 305 851 586 805 093 059 266 291 451 037 114 239 542 037 941 905 519 308 373 540 169 431 646 208;
  • 48) 0.392 644 494 198 703 804 143 812 305 851 586 805 093 059 266 291 451 037 114 239 542 037 941 905 519 308 373 540 169 431 646 208 × 2 = 0 + 0.785 288 988 397 407 608 287 624 611 703 173 610 186 118 532 582 902 074 228 479 084 075 883 811 038 616 747 080 338 863 292 416;
  • 49) 0.785 288 988 397 407 608 287 624 611 703 173 610 186 118 532 582 902 074 228 479 084 075 883 811 038 616 747 080 338 863 292 416 × 2 = 1 + 0.570 577 976 794 815 216 575 249 223 406 347 220 372 237 065 165 804 148 456 958 168 151 767 622 077 233 494 160 677 726 584 832;
  • 50) 0.570 577 976 794 815 216 575 249 223 406 347 220 372 237 065 165 804 148 456 958 168 151 767 622 077 233 494 160 677 726 584 832 × 2 = 1 + 0.141 155 953 589 630 433 150 498 446 812 694 440 744 474 130 331 608 296 913 916 336 303 535 244 154 466 988 321 355 453 169 664;
  • 51) 0.141 155 953 589 630 433 150 498 446 812 694 440 744 474 130 331 608 296 913 916 336 303 535 244 154 466 988 321 355 453 169 664 × 2 = 0 + 0.282 311 907 179 260 866 300 996 893 625 388 881 488 948 260 663 216 593 827 832 672 607 070 488 308 933 976 642 710 906 339 328;
  • 52) 0.282 311 907 179 260 866 300 996 893 625 388 881 488 948 260 663 216 593 827 832 672 607 070 488 308 933 976 642 710 906 339 328 × 2 = 0 + 0.564 623 814 358 521 732 601 993 787 250 777 762 977 896 521 326 433 187 655 665 345 214 140 976 617 867 953 285 421 812 678 656;
  • 53) 0.564 623 814 358 521 732 601 993 787 250 777 762 977 896 521 326 433 187 655 665 345 214 140 976 617 867 953 285 421 812 678 656 × 2 = 1 + 0.129 247 628 717 043 465 203 987 574 501 555 525 955 793 042 652 866 375 311 330 690 428 281 953 235 735 906 570 843 625 357 312;

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 - the converted number we get in the end will be just a very good approximation of the initial one).


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.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336(10) =


0.0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100 1(2)

5. Positive number before normalization:

1.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336(10) =


1.0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100 1(2)

6. Normalize the binary representation of the number.

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


1.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336(10) =


1.0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100 1(2) =


1.0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100 1(2) × 20


7. 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 0 (a positive number)


Exponent (unadjusted): 0


Mantissa (not normalized):
1.0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100 1


8. Adjust the exponent.

Use the 11 bit excess/bias notation:


Exponent (adjusted) =


Exponent (unadjusted) + 2(11-1) - 1 =


0 + 2(11-1) - 1 =


(0 + 1 023)(10) =


1 023(10)


9. 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 023 ÷ 2 = 511 + 1;
  • 511 ÷ 2 = 255 + 1;
  • 255 ÷ 2 = 127 + 1;
  • 127 ÷ 2 = 63 + 1;
  • 63 ÷ 2 = 31 + 1;
  • 31 ÷ 2 = 15 + 1;
  • 15 ÷ 2 = 7 + 1;
  • 7 ÷ 2 = 3 + 1;
  • 3 ÷ 2 = 1 + 1;
  • 1 ÷ 2 = 0 + 1;

10. Construct the base 2 representation of the adjusted exponent.

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


Exponent (adjusted) =


1023(10) =


011 1111 1111(2)


11. Normalize the mantissa.

a) Remove the leading (the leftmost) bit, since it's allways 1, and the decimal point, if the case.


b) Adjust its length to 52 bits, by removing the excess bits, from the right (if any of the excess bits is set on 1, we are losing precision...).


Mantissa (normalized) =


1. 0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100 1 =


0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100


12. The three elements that make up the number's 64 bit double precision IEEE 754 binary floating point representation:

Sign (1 bit) =
0 (a positive number)


Exponent (11 bits) =
011 1111 1111


Mantissa (52 bits) =
0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100


Decimal number 1.414 213 562 373 095 048 801 688 724 209 698 078 569 671 875 376 948 073 176 679 737 990 732 478 462 107 038 850 387 534 327 336 converted to 64 bit double precision IEEE 754 binary floating point representation:

0 - 011 1111 1111 - 0110 1010 0000 1001 1110 0110 0110 0111 1111 0011 1011 1100 1100

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:
    Exponent (adjusted) = Exponent (unadjusted) + 2(11-1) - 1
  • 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:

  • 1. Start with the positive version of the number:

    |-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)

    Exponent (unadjusted): 4

    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