snippetCritical
How do computers perform operations on numbers that are larger than 64 bits?
Viewed 0 times
operationslargerarebitsnumbersthancomputersperformthathow
Problem
There are many reasons why numbers larger than 64 bits must be computed. For example, cryptographic algorithms usually have to perform operations on numbers that are 256 bits or even larger in some cases. However, the programming languages that I use can only handle at maximum, 64 bit integers, so how do computers perform operations on numbers that are larger than 64 bits in size and which programming languages support computation of these larger numbers?
Solution
in school you (probably) memorized the common operations (addition, subtraction, multiplication and division) for decimal 1 digit numbers.
Then you learned how to do operations on larger numbers using those memorized operations by doing the computation part by part for example long multiplication and long division.
A computer can do the same algorithms using "digits" of whatever word size they can use carrying over the overflow into the next digit.
More advanced algorithms exist that operate a bit faster but still operate on the same principle of the large numbers being sequences of 32-bit or 64-bit digits.
Then you learned how to do operations on larger numbers using those memorized operations by doing the computation part by part for example long multiplication and long division.
A computer can do the same algorithms using "digits" of whatever word size they can use carrying over the overflow into the next digit.
More advanced algorithms exist that operate a bit faster but still operate on the same principle of the large numbers being sequences of 32-bit or 64-bit digits.
Context
StackExchange Computer Science Q#140881, answer score: 52
Revisions (0)
No revisions yet.