1
$\begingroup$

This is possibly a very trivial question for this site.

If I have a 64-bit laptop that means 2^64 combinations in total are possible.

But I can even get $2^{(x>>>64)}$ on my laptop.

Now, it is got to do something with the integer representation but I do not have enough background to understand it.

If let's say I had a 2-bit computer, 00 could represent 1, 01 could represent 1, 10 would represent 2, and 11 would represent 3. So that in total I had 2^2=4 numbers represented.

If somebody could show me how by using a kind of representation it is possible to represent a lot more numbers than 0,1,2,3 in this 2-bit computer I think would understand how it works for a 64-bit computer.

$\endgroup$
3
  • 2
    $\begingroup$ See this for an example in Python. $\endgroup$
    – Nathaniel
    Jan 12 at 18:20
  • $\begingroup$ See the famous GMP library? GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on $\endgroup$
    – kelalaka
    Jan 13 at 0:08
  • 1
    $\begingroup$ How can you write 10^2 on your decimal paper? $\endgroup$ Jan 16 at 8:48
2
$\begingroup$

Dynamic arrays is a solution to this problem. Lets say you have 11 in binary or 3 in decimal and you want to add 1. Your result would be 100 in binary and 4 in decimal. You can think of 3 and 1 like two "arrays" of bits and their result also like an "array" of bits. So take a look at the following image. You calculate the result till you fill the length of your "array" of bits. Once you fill it if the next digits is bigger than zero (assuming you keep them in a temporary array) you know that you have to allocate more memory, so you need to reserve more cells for the result "array" of bits.

Of course this is a super simple example.

enter image description here

There is a great library for C programming language that handles this kind of numbers. You can find out some examples here: https://home.cs.colorado.edu/~srirams/courses/csci2824-spr14/gmpTutorial.html

$\endgroup$
0
$\begingroup$

If let's say I had a 2-bit computer, 00 could represent 1, 01 could represent 1, 10 would represent 2, and 11 would represent 3. So that in total I had 2^2=4 numbers represented.

Let's say you have a number system that uses 10 different symbols to represent numbers. Let's call these symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

This means that in total, you can represent 10 numbers.

If somebody could show me how by using a kind of representation it is possible to represent a lot more numbers than 0,1,2,3 in this 2-bit computer I think would understand how it works for a 64-bit computer.

Do you understand how you can use only 10 symbols to represent an arbitrary amount of numbers of arbitrary size?

Well, you can use only 4 symbols, or only 2 symbols, or only 2^64 symbols, to represent an arbitrary amount of numbers of arbitrary size in exactly the same way.

Big number representation and arithmetic in computers works exactly the same as on paper. The only difference is that there are 2^64 "digits" instead of 10.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.