Big Num

A type (with many different implementations in many different languages, with many different semantics) for encoding arbitrary precision numbers (bounded only by the computer's memory). Compare this with standard types provided by many languages, where the range/precision is dictated by the underlying hardware, or the need/desire to fit in a constant amount of space.

Some languages only provide BigNum (considering fixed-size "int"s and the like to be relics from languages like CeeLanguage or CeePlusPlus); others provide both fixed- and arbitrary-precision number types (either as part of the language or the library). A related concept is BigInt, which allows integers of arbitrary size but does not encode non-integers.

Some BigNum implementations may have smaller limits--such as the restriction that the size of such a beast is bounded--often limited to the number of addresses which are addressable by a machine word--but in practice that seldom matters). BigNums are variable-size entities, consuming only as much space as needed to store the significant digits.

BigNums are often useful; but performance using BigNums pales compared to doing math on the underlying machine types. (Unless you have a VirtualMachine to slow the rest of your program down....) BigNums also are less-suitable for stack-based allocation (being of variable size), so if you use them prepare to 1) either have a GarbageCollector handy, or b) manually allocate and deallocate them. An alternate to BigNum (if you need greater range/precision than the machine types, but the range/precision you need is still bounded) is to define your own fixed-size types for your application. (Cryptography, where one often runs into 512- and 1024-bit integers, is such an application).

Many programming languages provide both BigNums and fixed-precision (or fixed-size FloatingPoint?) numeric types (integers and rationals/reals), and provide automatic conversion between them as appropriate.


See also: BigInt, http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic


EditText of this page (last edited April 20, 2014) or FindPage with title or text search