What are the libraries and in what languages can you organize arithmetic with very large numbers?
5 answers
Obviously, it is possible to organize in any Turing-full languages.
Here, sketched a list of some examples of widely used ready-made solutions for long arithmetic by languages. Basically, on integer arithmetic.
- C, C ++ - libgmp library
- Common Lisp - does not limit the width of integers
- Erlang - built-in numeric type (
integer()) - Go -
IntandRattypes from thebiglibrary. - Haskell - the built-in type
Integer - Java - class
java.math.BigInteger - OCaml -
numlibrary - Pascal / Delphi - MPArith Library
- Perl - bignum and bigrat modules
- PHP module BCMath
- Python - built-in type
long - Ruby -
BignumType - Scala -
BigIntclass - Scheme - starting with the R 5 RS recommendation, with R 6 RS - the requirement of unlimited number of digits (for example, see the Guile documentation )
- Languages .NET -
System.Numerics.BigIntegerclass (appeared in .NET Framework 4.0)
In Python, integers are not limited in length.
>>> 2**1000 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376L
- Can I do something like this in C-shaped languages? - Pavel Voevoda
- Already several times yesterday / the day before yesterday wrote: Gnu MP. gmplib.org . There are whole, and rational, and real. - alexlz
GCL - Gnu Common Lisp - the length of the number is limited by the size of the computer's RAM.
Haskell, type Integer Perl, BigInt module
What do libraries mean? What do big numbers mean? In any language, you can write if you include a little bit of brains.
take any number and expand it into an array of bits. What else do you need?
- @SoftR, I have professional ethics now struggling with the desire for order in the hashcode) Add at least a couple of examples or something) - Sh4dow
- I heard that, for example, in Java there is a class designed to work with numbers that are not included in the ranges of standard types. And I can expand the number into an array in turn, and so can - Pavel Voevoda
- Pavel, <a href="www.google.com/search?q=java+biginteger"> bigInt in java </a> - Sh4dow
- one@ Sh4dow I don’t mind adding the code to Delphi, but the question is asked so blurry that I don’t even know what to write about. It's one thing if he needs a huge integer, it's quite another thing if you need a very high precision after the decimal point. On the order of the hashcode, I fully understand you, you need to somehow force the questioners to ask questions in detail, and then the questioners think that the responding telepaths are. - SoftR
- So what's the point of writing the answer to a non-specific question?) You still don’t answer as it should, but de facto the message is not the answer (violation of the forum format). Such clarifications are written in the comments. - Sh4dow