DEV Community

Discussion on: Explain BigInt Like I'm Five

aswathm78 profile image
Aswath KNM

Microchips are made of transistors and they have 2 states

  1. ON(1)
  2. OFF(0)

Anything that runs in a computer turns into 0 or 1 so that the computer knows what to do.

For example '2' is represented as 0010 and 00000010 etc

Both the above mentioned numbers represent 2 in binary form but the digits it take to represent is different.

The first one is 4 bit representation and 2nd one is 8 bit.

So what happens when all the 8 bits are full and you want add another number with it

11111111(255) + 00000001(1)

When this operation happens there are three possibilities for an output . Either the excess bit will be cutoff or the computer recognises this operation and add another eight bits to it and the third one might be weird . It'll reset the count and start from its minimum value

Nowadays most computers are intelligent but it's a must known concept to understand Bigint

So what will happen if a number reaches a ** default maximum value of a computer ?? **

It happened to YouTube too

That's where user defined data types comes to scope .

It basically tells the computer to split a big value into small chunks and store in a separate variables and specifies how to do mathematical operations.

Bigint is one such data type .

[Here's a link which gives a decent comparison ](