Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The new BigInteger

.NET 4.0 now has a new data type, System.Numeric.BigInteger. From what I understand, this can hold numbers that have, up to, 1 million digits. Simple arithmetic operations can be performed on this number. What I am wondering is how Microsoft implemented such a thing, given that it would obviously exceed 32-bits and even 64-bits. How does this not overflow?

like image 803
Icemanind Avatar asked Dec 16 '22 22:12

Icemanind


1 Answers

Arithmetic operations have been performed on structures that exceed the native integer (and floating point) sizes for quite some time. This is ordinarily done by turning a single conceptual arithmetic operation on the larger structure (addition, for example), into a series of operations upon multiple native types.

like image 80
Adam Robinson Avatar answered Dec 19 '22 12:12

Adam Robinson