Ruby can store extremely large numbers. Now that I think about it though, I don't even know how that's possible.
Computers store data in a series of two digits (0s and 1s). This is referred to as binary notation. However, there is a limit to the size of numbers they can store.
Most current Operating Systems these days run at 64 bits. That means the highest allocatable address space for a variable is 64 bits.
Integers are stored in a base 2 system, which means the highest value a computer should be able to store is
1111111111111111111111111111111111111111111111111111111111111111
Since computers can only read 2 possible values, this means the above number can be represented as
2 ^ 64
This means that the highest value an integer can read should be at most 18,446,744,073,709,551,615
I honestly don't even understand how it's possible to store integer values higher than that.
Ruby uses
Bignum
objects to store number larger than2^64
. You can see here a description of how this works: