user3556163
user3556163

Reputation: 114

Working with arbitrary numbers

I want to write a class which can handle numbers of an arbitrary length with simple commands such as DD(10000000000,10000000000) to show 20000000000

I've found a list of the limits in C# for data types:

Data type                                     Maximum positive value
Int32                                                  2,147,483,647
UInt32                                                 4,294,967,295
Int64                                      9,223,372,036,854,775,808
UInt64                                    18,446,744,073,709,551,615

But what if my number, for example, is 20,000,000,000,000,000,000,000,000

How would I do it?

Upvotes: 1

Views: 110

Answers (2)

w.b
w.b

Reputation: 11238

You can use System.Numerics.BigInteger:

http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx

Upvotes: 7

Tim Schmelter
Tim Schmelter

Reputation: 460360

You can use System.Numerics.BigInteger

Represents an arbitrarily large signed integer.

Upvotes: 6

Related Questions