Can I Use Big Integers in C# with GMP on Windows?

  • Thread starter CodeMonkey
  • Start date
  • Tags
    Integers
In summary, the conversation discusses using arbitrarily long integers in Csharp and the options available for implementing them. The speaker suggests using third-party classes or installing the GNU package for large numbers, gmp.dll, to improve performance for numbers with more than 30 digits. They also provide a link for more information on installing gmp.dll in Windows.
  • #1
CodeMonkey
11
0
I want to use arbitrarily long integers in Csharp, can you tell me how to declare and use this. Please explain the namespace, classes used as I'm very new to this. Thanks.
 
Technology news on Phys.org
  • #2
I don't think Microsoft has anything for this at the moment. You should be able to Google up third-party classes for big numbers, though; http://www.codeproject.com/csharp/biginteger.asp [Broken] would be an example.

Frankly, it's no better than the Java BigNumber implementation, which also has poor performance for large numbers (> 30 digits, say).
 
Last edited by a moderator:
  • #3
You can backdoor install gmp - the GNU package for large numbers. It's possible to compile a gmp.dll that you can use in Windows. See:

http://cs.nyu.edu/exact/core/gmp/
 
  • #4
jim mcnamara said:
You can backdoor install gmp - the GNU package for large numbers. It's possible to compile a gmp.dll that you can use in Windows.

Oh yes, this is much better.
 

1. What are big integers and when should they be used?

Big integers are numbers that exceed the maximum value that can be stored in a standard integer data type. They are typically used when dealing with extremely large numbers, such as in cryptography or scientific calculations.

2. How do I declare and initialize a big integer variable?

In most programming languages, big integers are declared and initialized using a specific data type or library. For example, in Java, the BigInteger class is used to declare and initialize big integer variables.

3. What operations can I perform on big integers?

Most programming languages have built-in methods or libraries for performing basic arithmetic operations on big integers, such as addition, subtraction, multiplication, and division. Some languages also have libraries for more complex operations, such as exponentiation and modular arithmetic.

4. How do I handle errors or exceptions when using big integers?

When using big integers, it is important to handle errors and exceptions that may occur. This can be done by using try-catch blocks or by checking for potential errors before performing operations on big integers.

5. Are there any performance implications when using big integers?

Since big integers require more memory and processing power than standard integers, there may be some performance implications when using them. It is important to consider the efficiency of operations and the limitations of the programming language being used when working with big integers.

Similar threads

  • Programming and Computer Science
2
Replies
47
Views
2K
  • Programming and Computer Science
Replies
34
Views
2K
Replies
9
Views
941
  • Programming and Computer Science
Replies
7
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
2
Replies
35
Views
2K
  • Programming and Computer Science
Replies
15
Views
4K
  • Programming and Computer Science
2
Replies
36
Views
2K
  • Programming and Computer Science
Replies
19
Views
2K
Back
Top