Is there a way to present very long numbers?

Possible duplicate:
works with incredibly large numbers in .NET

I am working on a simple project that should use basic arithmetic functions such as +, -, *, /. The numbers used are too large to be stored in a 64-bit Integer.

I wondered if there is a way to store these numbers so that I can use them to perform arithmetic functions.

Thanks!

+4
source share
2 answers

BigInteger (.NET 4.0+) to the rescue!

Represents an arbitrarily large signed integer.

If you're in pre-dating 4.0, check out the BigNumbers library.

+11
source

You can use the BigInteger type that was introduced in .NET 4.

Represents an arbitrarily large signed integer.


You can use an instance of BigInteger , as you would use any other type of integral. BigInteger overloads standard numeric operators so you can perform basic mathematical operations such as addition, subtraction, division, multiplication, subtraction, negation, and unary negation.

+8
source

Source: https://habr.com/ru/post/1395839/


All Articles