.net - What is the limit of the Value Type BigInteger in C#? -


As described in MSDN:

An irreversible type that arbitrarily large The integer represents the principle that there is no upper or lower limit of the value.

As I can see BigInteger is a ValueType , as much as I know, maximum size 16 bytes in a ValueType.

MSDN further says:

For an operation, an out-of-my-site opsion can be thrown, causing the cause of the Bigentor value too large.

and more:

Although this process is transparent to call, it executes an execution in some cases, especially when large In the loop there are functions to be repeated in the loop,

How big can it store for values, as double.MaxValue + double.MaxValue ? I was told that in the reference type there is the objection in it, but I can find it here in VisualStudio by definition in ValueTypes.

What is its actual limit? And even if there is not even one, how can it manage to accumulate all this data as "a value"?

As I've seen BigInteger is a ValueType, as much as I know, a ValueType Must be at most 16 bytes

No, this is not true. This is an traditional range, but it is entirely possible for a value type, take more than that. For example:

  public configuration foo {private readonly int a, b, c, d, e; // ma look, 20 bytes! }  

However, I strongly suspect that BigInteger is actually included in the context of a byte array:

  public Bigteggar {Private read-only byte [] data; // shows a current implementation using some other field ...}  

( int and uint [] , But surely Description is knowingly hidden.)

then value may be BigInteger still small , But see a large part of this collection - and if you need to perform a task that there is not enough memory to allocate, then you will get an exception.

How to store such large values, double as big. MaxValue + double.MaxValue?

good BigInteger integer , so I do not particularly want it to be something from double Also to use to ... but how much memory you have got fundamentally and can cope with the size of the CRR. In reality, you will actually be talking about the number of heavy before killing the limit of any specific number - but if you have small numbers of gazes, then obviously large memory There are also requirements.


Comments