Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to use Big Integers?

  1. Nov 14, 2007 #1
    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.
     
  2. jcsd
  3. Nov 14, 2007 #2

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    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 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).
     
  4. Nov 14, 2007 #3

    jim mcnamara

    User Avatar
    Science Advisor
    Gold Member

    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/
     
  5. Nov 14, 2007 #4

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    Oh yes, this is much better.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?