Best coding language for working with large numbers (50,000 + digits)

Can you recommend some good math languages ​​with big numbers?

So far I have used ActionScript 2 and Objective-c and Objective-c, even using NSDecimalNumbers . I was limited to 32 digits in my calculations ... I needed at least fifty thousand digits to calculate the numbers.

+1
source share
5 answers

Perhaps Haskell will appeal to you.

+2
source

Python has integers of arbitrary length and uses them transparently, so you don’t need special code or classes for this.

 >>> len(str(math.factorial(123456))) 574965 
+3
source

Try bc , which is probably already installed on your computer.

+2
source

Try java with the BigInteger class or you can look at writing a small library in C. If the math is pretty simple, you can always use arrays.

Maybe try matlab (not sure)

+1
source

Currently, most languages ​​have some support for arbitrary length numbers, initially in the language or through some external library (e.g. gmp).

The only important difference * is the level of integration within the language. For example, in C ++ Python, Perl, SWI-Prolog, Haskell, C #, etc. Big-ints can be manipulated like any other built-in numeric type using standard mathematical operators. On the other hand, in languages ​​that do not support operator overloading like C, Objective-C, Java, etc., you must explicitly use the library functions.

Depending on the prevalence of operations with a large number of operations in your application, it may pay off to switch to a more convenient language or not.

Update

[*] Well, obviously, correctness and speed are also important. But, since most languages ​​use GMP under the hood, there should be no distinction between mayors. Maybe mathematically oriented (and expensive!) Languages ​​/ applications like Mathematica or Maple, providing their own implementations with lots of them, may have some advantages here.

+1
source

All Articles