Question

how to declare int1024 in C#? i can use VB or C++ Too.

Regards
Behrooz

Was it helpful?

Solution

See this question: Big integers in C#

From the answer to that question:

MS is going to introduce System.Numerics.BigInteger class in .NET 4.0

Until then, look at IntX class.

IntX is an arbitrary precision integers library written in pure C# 2.0 with fast - O(N * log N) - multiplication/division algorithms implementation. It provides all the basic operations on integers like addition, multiplication, comparing, bitwise shifting etc.

OTHER TIPS

And by that do you mean a 1024-bit integer? Better wait until BigInteger in 4.0. Until then, the cheekiest you can do with the core libraries is to (ab)use decimal, which has 96 bits for the integer part. Or use a 3rd-party dll.

Just for avoidance of doubt:

public int int1024 = 1024;

If I understand you correctly you want a 1024 bit integer.

Unfortunately there is no inbuilt 1024 bit integer type in .net. You would have to find a specialised library for that kind of thing or write one yourself.

There is an article about big integers here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top