What are the required steps to convert base 10 integer
number 34 165 590 585 603 537 to signed binary code (in base 2)?
- A signed integer, written in base ten, or a decimal system number, is a number written using the digits 0 through 9 and the sign, which can be positive (+) or negative (-). If positive, the sign is usually not written. A number written in base two, or binary, is a number written using only the digits 0 and 1.
1. Divide the number repeatedly by 2:
Keep track of each remainder.
Stop when you get a quotient that is equal to zero.
- division = quotient + remainder;
- 34 165 590 585 603 537 ÷ 2 = 17 082 795 292 801 768 + 1;
- 17 082 795 292 801 768 ÷ 2 = 8 541 397 646 400 884 + 0;
- 8 541 397 646 400 884 ÷ 2 = 4 270 698 823 200 442 + 0;
- 4 270 698 823 200 442 ÷ 2 = 2 135 349 411 600 221 + 0;
- 2 135 349 411 600 221 ÷ 2 = 1 067 674 705 800 110 + 1;
- 1 067 674 705 800 110 ÷ 2 = 533 837 352 900 055 + 0;
- 533 837 352 900 055 ÷ 2 = 266 918 676 450 027 + 1;
- 266 918 676 450 027 ÷ 2 = 133 459 338 225 013 + 1;
- 133 459 338 225 013 ÷ 2 = 66 729 669 112 506 + 1;
- 66 729 669 112 506 ÷ 2 = 33 364 834 556 253 + 0;
- 33 364 834 556 253 ÷ 2 = 16 682 417 278 126 + 1;
- 16 682 417 278 126 ÷ 2 = 8 341 208 639 063 + 0;
- 8 341 208 639 063 ÷ 2 = 4 170 604 319 531 + 1;
- 4 170 604 319 531 ÷ 2 = 2 085 302 159 765 + 1;
- 2 085 302 159 765 ÷ 2 = 1 042 651 079 882 + 1;
- 1 042 651 079 882 ÷ 2 = 521 325 539 941 + 0;
- 521 325 539 941 ÷ 2 = 260 662 769 970 + 1;
- 260 662 769 970 ÷ 2 = 130 331 384 985 + 0;
- 130 331 384 985 ÷ 2 = 65 165 692 492 + 1;
- 65 165 692 492 ÷ 2 = 32 582 846 246 + 0;
- 32 582 846 246 ÷ 2 = 16 291 423 123 + 0;
- 16 291 423 123 ÷ 2 = 8 145 711 561 + 1;
- 8 145 711 561 ÷ 2 = 4 072 855 780 + 1;
- 4 072 855 780 ÷ 2 = 2 036 427 890 + 0;
- 2 036 427 890 ÷ 2 = 1 018 213 945 + 0;
- 1 018 213 945 ÷ 2 = 509 106 972 + 1;
- 509 106 972 ÷ 2 = 254 553 486 + 0;
- 254 553 486 ÷ 2 = 127 276 743 + 0;
- 127 276 743 ÷ 2 = 63 638 371 + 1;
- 63 638 371 ÷ 2 = 31 819 185 + 1;
- 31 819 185 ÷ 2 = 15 909 592 + 1;
- 15 909 592 ÷ 2 = 7 954 796 + 0;
- 7 954 796 ÷ 2 = 3 977 398 + 0;
- 3 977 398 ÷ 2 = 1 988 699 + 0;
- 1 988 699 ÷ 2 = 994 349 + 1;
- 994 349 ÷ 2 = 497 174 + 1;
- 497 174 ÷ 2 = 248 587 + 0;
- 248 587 ÷ 2 = 124 293 + 1;
- 124 293 ÷ 2 = 62 146 + 1;
- 62 146 ÷ 2 = 31 073 + 0;
- 31 073 ÷ 2 = 15 536 + 1;
- 15 536 ÷ 2 = 7 768 + 0;
- 7 768 ÷ 2 = 3 884 + 0;
- 3 884 ÷ 2 = 1 942 + 0;
- 1 942 ÷ 2 = 971 + 0;
- 971 ÷ 2 = 485 + 1;
- 485 ÷ 2 = 242 + 1;
- 242 ÷ 2 = 121 + 0;
- 121 ÷ 2 = 60 + 1;
- 60 ÷ 2 = 30 + 0;
- 30 ÷ 2 = 15 + 0;
- 15 ÷ 2 = 7 + 1;
- 7 ÷ 2 = 3 + 1;
- 3 ÷ 2 = 1 + 1;
- 1 ÷ 2 = 0 + 1;
2. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
34 165 590 585 603 537(10) = 111 1001 0110 0001 0110 1100 0111 0010 0110 0101 0111 0101 1101 0001(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 55.
- A signed binary's bit length must be equal to a power of 2, as of:
- 21 = 2; 22 = 4; 23 = 8; 24 = 16; 25 = 32; 26 = 64; ...
- The first bit (the leftmost) is reserved for the sign:
- 0 = positive integer number, 1 = negative integer number
The least number that is:
1) a power of 2
2) and is larger than the actual length, 55,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 64.
4. Get the positive binary computer representation on 64 bits (8 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 64:
34 165 590 585 603 537(10) Base 10 integer number converted and written as a signed binary code (in base 2):
34 165 590 585 603 537(10) = 0000 0000 0111 1001 0110 0001 0110 1100 0111 0010 0110 0101 0111 0101 1101 0001
Spaces were used to group digits: for binary, by 4, for decimal, by 3.