What are the required steps to convert base 10 integer
number 457 283 197 986 495 262 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;
- 457 283 197 986 495 262 ÷ 2 = 228 641 598 993 247 631 + 0;
- 228 641 598 993 247 631 ÷ 2 = 114 320 799 496 623 815 + 1;
- 114 320 799 496 623 815 ÷ 2 = 57 160 399 748 311 907 + 1;
- 57 160 399 748 311 907 ÷ 2 = 28 580 199 874 155 953 + 1;
- 28 580 199 874 155 953 ÷ 2 = 14 290 099 937 077 976 + 1;
- 14 290 099 937 077 976 ÷ 2 = 7 145 049 968 538 988 + 0;
- 7 145 049 968 538 988 ÷ 2 = 3 572 524 984 269 494 + 0;
- 3 572 524 984 269 494 ÷ 2 = 1 786 262 492 134 747 + 0;
- 1 786 262 492 134 747 ÷ 2 = 893 131 246 067 373 + 1;
- 893 131 246 067 373 ÷ 2 = 446 565 623 033 686 + 1;
- 446 565 623 033 686 ÷ 2 = 223 282 811 516 843 + 0;
- 223 282 811 516 843 ÷ 2 = 111 641 405 758 421 + 1;
- 111 641 405 758 421 ÷ 2 = 55 820 702 879 210 + 1;
- 55 820 702 879 210 ÷ 2 = 27 910 351 439 605 + 0;
- 27 910 351 439 605 ÷ 2 = 13 955 175 719 802 + 1;
- 13 955 175 719 802 ÷ 2 = 6 977 587 859 901 + 0;
- 6 977 587 859 901 ÷ 2 = 3 488 793 929 950 + 1;
- 3 488 793 929 950 ÷ 2 = 1 744 396 964 975 + 0;
- 1 744 396 964 975 ÷ 2 = 872 198 482 487 + 1;
- 872 198 482 487 ÷ 2 = 436 099 241 243 + 1;
- 436 099 241 243 ÷ 2 = 218 049 620 621 + 1;
- 218 049 620 621 ÷ 2 = 109 024 810 310 + 1;
- 109 024 810 310 ÷ 2 = 54 512 405 155 + 0;
- 54 512 405 155 ÷ 2 = 27 256 202 577 + 1;
- 27 256 202 577 ÷ 2 = 13 628 101 288 + 1;
- 13 628 101 288 ÷ 2 = 6 814 050 644 + 0;
- 6 814 050 644 ÷ 2 = 3 407 025 322 + 0;
- 3 407 025 322 ÷ 2 = 1 703 512 661 + 0;
- 1 703 512 661 ÷ 2 = 851 756 330 + 1;
- 851 756 330 ÷ 2 = 425 878 165 + 0;
- 425 878 165 ÷ 2 = 212 939 082 + 1;
- 212 939 082 ÷ 2 = 106 469 541 + 0;
- 106 469 541 ÷ 2 = 53 234 770 + 1;
- 53 234 770 ÷ 2 = 26 617 385 + 0;
- 26 617 385 ÷ 2 = 13 308 692 + 1;
- 13 308 692 ÷ 2 = 6 654 346 + 0;
- 6 654 346 ÷ 2 = 3 327 173 + 0;
- 3 327 173 ÷ 2 = 1 663 586 + 1;
- 1 663 586 ÷ 2 = 831 793 + 0;
- 831 793 ÷ 2 = 415 896 + 1;
- 415 896 ÷ 2 = 207 948 + 0;
- 207 948 ÷ 2 = 103 974 + 0;
- 103 974 ÷ 2 = 51 987 + 0;
- 51 987 ÷ 2 = 25 993 + 1;
- 25 993 ÷ 2 = 12 996 + 1;
- 12 996 ÷ 2 = 6 498 + 0;
- 6 498 ÷ 2 = 3 249 + 0;
- 3 249 ÷ 2 = 1 624 + 1;
- 1 624 ÷ 2 = 812 + 0;
- 812 ÷ 2 = 406 + 0;
- 406 ÷ 2 = 203 + 0;
- 203 ÷ 2 = 101 + 1;
- 101 ÷ 2 = 50 + 1;
- 50 ÷ 2 = 25 + 0;
- 25 ÷ 2 = 12 + 1;
- 12 ÷ 2 = 6 + 0;
- 6 ÷ 2 = 3 + 0;
- 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.
457 283 197 986 495 262(10) = 110 0101 1000 1001 1000 1010 0101 0101 0001 1011 1101 0101 1011 0001 1110(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 59.
- 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, 59,
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:
457 283 197 986 495 262(10) Base 10 integer number converted and written as a signed binary code (in base 2):
457 283 197 986 495 262(10) = 0000 0110 0101 1000 1001 1000 1010 0101 0101 0001 1011 1101 0101 1011 0001 1110
Spaces were used to group digits: for binary, by 4, for decimal, by 3.