Search code examples
integer64-bitlarge-databigdata

How does Windows handle unsigned 64bit integers?


I was wondering, how can a machine that is limited to 64 bit handle complicated mathematics and calculations involving numbers that are bigger than the larger number that it can 'imagine'? For example, a how could a 8 bit system add numbers that are bigger than 255? Why doesn't it cause an overflow?

I am talking mainly about Windows based systems, and not any specific programming language, I do know some programming languages such as Python can handle near infinite digits for both signed and unsigned integers without problems.

Thank you.

-Master-chip


Solution

  • is "simply" emulated in software. As humans can handle numbers beyond their fingers, software can use more bytes to store more bits, and propagate bits on MSB on the right. Suppose You use 16 bits in 8 bits µP:

    you take LSBs and add them. if carry take it in account. add MSB, and eventually add carry.

    addendum A can be written as: 8ˆ1* (MSBa) + 8ˆ0 * (LSBa) the same for B. is "simply" emulated in software. As humans can handle numbers beyond their fingers, software can use more bytes to store more bits, and propagate bits on MSB on the right. Suppose You use 16 bits in 8 bits µP:

    you take LSBs and add them. if carry take it in account. add MSB, and eventually add carry.

    addendum A can be written as: 8ˆ1* (MSBa) + 8ˆ0 * (LSBa) the same for B: 8ˆ1* (MSBb) + 8ˆ0 * (LSBb)

    so A+B is: 8ˆ1* (MSBa) + 8ˆ0 * (LSBa) + 8ˆ1* (MSBb) + 8ˆ0 * (LSBb) =

    8ˆ1* (MSBa + MSBb) + 8ˆ0 * (LSB a + LSBb)