This article lists libraries, applications, and other software which enable or support
arbitrary-precision arithmetic.
Libraries
Stand-alone application software
Software that supports arbitrary precision computations:
*
bc the
POSIX
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
arbitrary-precision arithmetic language that comes standard on most
Unix-like
A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems.
**
dc: "Desktop Calculator" arbitrary-precision RPN calculator that comes standard on most
Unix-like
A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems.
*
KCalc
KCalc is the software calculator integrated with the KDE Gear. In the default view it includes a number pad, buttons for adding, subtracting, multiplying, and dividing, brackets, memory keys, percent, reciprocal, factorial, square, and x to the p ...
, Linux based scientific calculator
*
Maxima: a
computer algebra system
A computer algebra system (CAS) or symbolic algebra system (SAS) is any mathematical software with the ability to manipulate mathematical expressions in a way similar to the traditional manual computations of mathematicians and scientists. The de ...
which ''bignum'' integers are directly inherited from its implementation language
Common Lisp
Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
. In addition, it supports arbitrary-precision floating-point numbers, ''bigfloats''.
*
Maple
''Acer'' () is a genus of trees and shrubs commonly known as maples. The genus is placed in the family Sapindaceae.Stevens, P. F. (2001 onwards). Angiosperm Phylogeny Website. Version 9, June 2008 nd more or less continuously updated since http ...
,
Mathematica
Wolfram Mathematica is a software system with built-in libraries for several areas of technical computing that allow machine learning, statistics, symbolic computation, data manipulation, network analysis, time series analysis, NLP, optimizat ...
, and several other
computer algebra
In mathematics and computer science, computer algebra, also called symbolic computation or algebraic computation, is a scientific area that refers to the study and development of algorithms and software for manipulating mathematical expressions ...
software include arbitrary-precision arithmetic. Mathematica employs
GMP
GMP may refer to:
Finance and economics
* Gross metropolitan product
* Guaranteed maximum price
* Guaranteed Minimum Pension
Science and technology
* GNU Multiple Precision Arithmetic Library, a software library
* Granulocyte-macrophage progenit ...
for approximate number computation.
*
PARI/GP
PARI/GP is a computer algebra system with the main aim of facilitating number theory computations. Versions 2.1.0 and higher are distributed under the GNU General Public License. It runs on most common operating systems.
System overview
The P ...
, an
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
computer algebra system that supports arbitrary precision.
*
Qalculate!, an open-source free software arbitrary precision calculator with autocomplete.
*
SageMath, an open-source
computer algebra system
A computer algebra system (CAS) or symbolic algebra system (SAS) is any mathematical software with the ability to manipulate mathematical expressions in a way similar to the traditional manual computations of mathematicians and scientists. The de ...
*
SymPy, a CAS
*Symbolic Math toolbox (
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
)
*
Windows Calculator
Windows Calculator is a software calculator developed by Microsoft and included in Windows. In its Windows 10 incarnation it has four modes: standard, scientific, programmer, and a graphing mode. The standard mode includes a number pad and butto ...
, since Windows 98, uses arbitrary precision for basic operations (addition, subtraction, multiplication, division) and 32 digits of precision for advanced operations (square root, transcendental functions).
SmartXML a free programming language with integrated development environment (IDE) for mathematical calculations. Variables of BigNumber type can be used, or regular numbers can be converted to big numbers using conversion operator # (e.g., #2.3^2000.1). SmartXML big numbers can have up to 100,000,000 decimal digits and up to 100,000,000 whole digits.
Languages
Programming languages that support arbitrary precision computations, either built-in, or in the standard library of the language:
*
Ada
Ada may refer to:
Places
Africa
* Ada Foah, a town in Ghana
* Ada (Ghana parliament constituency)
* Ada, Osun, a town in Nigeria
Asia
* Ada, Urmia, a village in West Azerbaijan Province, Iran
* Ada, Karaman, a village in Karaman Province, Tur ...
: the upcoming Ada 202x revision adds th
Ada.Numerics.Big_Numbers.Big_Integers
an
packages to the standard library, providing arbitrary precision integers and real numbers.
*
Agda Agda may refer to:
* Agda (programming language), the programming language and theorem prover
* Agda (Golgafrinchan), the character in ''The Hitchhiker's Guide to the Galaxy'' by Douglas Adams
* Liten Agda, the heroine of a Swedish legend
* Agda M ...
: the
BigInt
datatype o
Epicbackend implements arbitrary-precision arithmetic.
*
Common Lisp
Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
: The ANSI Common Lisp standard supports arbitrary precision integer, ratio, and complex numbers.
*
C#System.Numerics.BigInteger
from
.NET 5
*
ColdFusion
Adobe ColdFusion is a commercial rapid web-application development computing platform created by J. J. Allaire in 1995. (The programming language used with that platform is also commonly called ColdFusion, though is more accurately known as CF ...
: the built-in
PrecisionEvaluate()
function evaluates one or more string expressions, dynamically, from left to right, using BigDecimal precision arithmetic to calculate the values of arbitrary precision arithmetic expressions.
*
D: standard library modul
std.bigint
*
Dart
Dart or DART may refer to:
* Dart, the equipment in the game of darts
Arts, entertainment and media
* Dart (comics), an Image Comics superhero
* Dart, a character from ''G.I. Joe''
* Dart, a ''Thomas & Friends'' railway engine character
* Dar ...
: the built-in
int
datatype implements arbitrary-precision arithmetic.
*
Emacs Lisp: supports integers of arbitrary size, starting with Emacs 27.1.
*
Erlang: the built-in
Integer
datatype implements arbitrary-precision arithmetic.
*
Go: the standard library packag
math/big
implements arbitrary-precision integers (
Int
type), rational numbers (
Rat
type), and floating-point numbers (
Float
type)
*
Guile: the built-in
exact
numbers are of arbitrary precision. Example:
(expt 10 100)
produces the expected (large) result. Exact numbers also include rationals, so
(/ 3 4)
produces
3/4
. One of the languages implemented in Guile is
Scheme A scheme is a systematic plan for the implementation of a certain idea.
Scheme or schemer may refer to:
Arts and entertainment
* ''The Scheme'' (TV series), a BBC Scotland documentary series
* The Scheme (band), an English pop band
* ''The Schem ...
.
*
Haskell: the built-in
Integer
datatype implements arbitrary-precision arithmetic and the standard
Data.Ratio
module implements rational numbers.
*
Idris Idris may refer to:
People
* Idris (name), a list of people and fictional characters with the given name or surname
* Idris (prophet), Islamic prophet in the Qur'an, traditionally identified with Enoch, an ancestor of Noah in the Bible
* Idris G ...
: the built-in
Integer
datatype implements arbitrary-precision arithmetic.
*
ISLISP: The ISO/IEC 13816:1997(E)
ISLISP standard supports arbitrary precision integer numbers.
*
J: built-in ''extended precision''
*
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
: Class (integer), Class (decimal)
*
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
: as of
ES2020, BigInt is supported in most browsers;
the
/code.google.com/p/gwt-math/ gwt-mathlibrary provides an interface to
java.math.BigDecimal
, and libraries such a
DecimalJSan
Crunchsupport arbitrary-precision integers.
*
Julia: the built-i
BigFloat
and
BigInt
types provide arbitrary-precision floating point and integer arithmetic respectively.
*
newRPL
RPL is a calculator, handheld calculator operating system and application programming language used on Hewlett-Packard's scientific graphing Reverse Polish Notation, RPN (Reverse Polish Notation) calculators of the HP-28 series, HP 28, HP 48 seri ...
: integers and floats can be of arbitrary precision (up to at least 2000 digits); maximum number of digits configurable (default 32 digits)
*
Nim
Nim is a mathematical two player game.
Nim or NIM may also refer to:
* Nim (programming language)
* Nim Chimpsky, a signing chimpanzee Acronyms
* Network Installation Manager, an IBM framework
* Nuclear Instrumentation Module
* Negative index met ...
bigintsand multipl
GMP bindings
*
OCaml
OCaml ( , formerly Objective Caml) is a general-purpose programming language, general-purpose, multi-paradigm programming language which extends the Caml dialect of ML (programming language), ML with object-oriented programming, object-oriented ...
: Th
Numlibrary supports arbitrary-precision integers and rationals.
*
OpenLisp
OpenLisp is a programming language in the Lisp family developed by Christian Jullien from Eligis. It conforms to the international standard for ISLISP published jointly by the International Organization for Standardization (ISO) and Internationa ...
: supports arbitrary precision integer numbers.
*
Perl
Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
: Th
bignum
an
pragmas provide BigNum and BigRational support for Perl.
*
PHP
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by The PHP Group ...
: The
/php.net/manual/en/book.bc.php BC Mathmodule provides arbitrary precision mathematics.
*
PicoLisp: supports arbitrary precision integers.
*
Pike: the built-in
int
type will silently change from machine-native integer to arbitrary precision as soon as the value exceeds the former's capacity.
*
Prolog: ISO standard compatible Prolog systems can check the Prolog flag "bounded". Most of the major Prolog systems support arbitrary precision integer numbers.
*
Python: the built-in
int
(3.x) /
long
(2.x) integer type is of arbitrary precision. The
Decimal
class in the standard library module ''decimal'' has user definable precision and limited mathematical operations (exponentiation, square root, etc. but no trigonometric functions). The
Fraction
class in the module ''fractions'' implements rational numbers. More extensive arbitrary precision floating point arithmetic is available with the third-party "mpmath" and "bigfloat" packages.
*
Racket
Racket may refer to:
* Racket (crime), a systematised element of organized crime
** Protection racket, a scheme whereby a group provides protection to businesses or other groups through violence outside the sanction of the law
* Racket (sports equ ...
: the built-in
exact
numbers are of arbitrary precision. Example:
(expt 10 100)
produces the expected (large) result. Exact numbers also include rationals, so
(/ 3 4)
produces
3/4
. Arbitrary precision floating point numbers are included in the standard librar
math/bigfloatmodule.
*
Raku: Rakudo supports
Int">/doc.perl6.org/type/Int Int
and
FatRat">/doc.perl6.org/type/FatRat FatRat
data types that promote to arbitrary-precision integers and rationals.
*
Rexx
Rexx (Restructured Extended Executor) is a programming language that can be interpreted or compiled. It was developed at IBM by Mike Cowlishaw. It is a structured, high-level programming language designed for ease of learning and reading. ...
: variants including Open Object Rexx and NetRexx
*
RPL (only on
HP 49/50 series
The HP 49/50 series are Hewlett-Packard (HP) manufactured graphing calculators. They are the successors of the popular HP 48 series.
There are five calculators in the 49/50 series of HP graphing calculators. These calculators have both a ...
in ''exact mode''): calculator treats numbers entered without decimal point as integers rather than floats; integers are of arbitrary precision only limited by the available memory.
*
Ruby: the built-in
Bignum
integer type is of arbitrary precision. The
BigDecimal
class in the standard library module ''bigdecimal'' has user definable precision.
*
Scheme A scheme is a systematic plan for the implementation of a certain idea.
Scheme or schemer may refer to:
Arts and entertainment
* ''The Scheme'' (TV series), a BBC Scotland documentary series
* The Scheme (band), an English pop band
* ''The Schem ...
: R
5RS encourages, and R
6RS requires, that exact integers and exact rationals be of arbitrary precision.
*
ScalaClass BigInt
an
*
Seed7
Seed7 is an extensible general-purpose programming language designed by Thomas Mertes. It is syntactically similar to Pascal and Ada. Along with many other features, it provides an extension mechanism. Daniel Zingaro"Modern Extensible Languages" ...
bigInteger
an
*
Self: arbitrary precision integers are supported by the built-in
bigInt
type.
*
Smalltalk
Smalltalk is an object-oriented, dynamically typed reflective programming language. It was designed and created in part for educational use, specifically for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Ka ...
: variants including
Squeak,
Smalltalk/X,
GNU Smalltalk,
Dolphin Smalltalk, etc.
SmartXML a free programming language with integrated development environment (IDE) for mathematical calculations. Variables of
BigNumber
type can be used, or regular numbers can be converted to big numbers using conversion operator
#
(e.g.,
#2.3^2000.1
). SmartXML big numbers can have up to 100,000,000 decimal digits and up to 100,000,000 whole digits.
*
Standard ML
Standard ML (SML) is a general-purpose, modular, functional programming language with compile-time type checking and type inference. It is popular among compiler writers and programming language researchers, as well as in the development of the ...
: The optional built-i
IntInf
structure implements the ''INTEGER'' signature and supports arbitrary-precision integers.
*
Tcl: As of version 8.5 (2007), integers are arbitrary-precision by default. (Behind the scenes, the language switches to using an arbitrary-precision internal representation for integers too large to fit in a machine word. Bindings from
C should use library functions such as
Tcl_GetLongFromObj
to get values as C-native data types from Tcl integers.)
*
Wolfram Language, like
Mathematica
Wolfram Mathematica is a software system with built-in libraries for several areas of technical computing that allow machine learning, statistics, symbolic computation, data manipulation, network analysis, time series analysis, NLP, optimizat ...
, employs GMP for approximate number computation.
Online calculators
For one-off calculations. Runs on server or in browser. No installation or compilation required.
* 1. https://www.mathsisfun.com/calculator-precision.html 200 places
* 2. http://birrell.org/andrew/ratcalc/ arbitrary; select rational or fixed-point and number of places
* 3. PARI/GP online calculator - https://pari.math.u-bordeaux.fr/gp.html (PARI/GP is a widely used computer algebra system designed for fast computations in number theory (factorizations, algebraic number theory, elliptic curves, modular forms, L functions...), but also contains a large number of other useful functions to compute with mathematical entities such as matrices, polynomials, power series, algebraic numbers etc., and a lot of transcendental functions. PARI is also available as a C library to allow for faster computations.)
* 4.1
AutoCalcs- allow users to Search, Create, Store and Share multi-step calculations using explicit expressions featuring automated Unit Conversion. It is a platform that allows users to go beyond unit conversion, which in turn brings in significantly improved efficiency. A lot of sample calculations can be found at AutoCalcs Docs site. Calculations created with AutoCalcs can be embedded into 3rd party websites.
* 4.2
AutoCalcs Docs- considering above mentione
AutoCalcsas the calculation engine, this Docs site is a library with a host of calculations, where each calculation is essentially a web app that can run online, be further customized, and much more. Imaging reading a book with a lot of calculations, then this is the book/manual with all calculations that can be used on the fly. It is worthwhile to mention - when units are involved in the calculations, the unit conversion can be automated.
References
{{DEFAULTSORT:Arbitrary precision arithmetic software
Lists of software
Computer arithmetic