Arbitrary Precision Mathematics

In our class we have talked about single and double precision mathematics floating point numbers and how these are stored. Another class of computer numbers also exist called arbitrary precision numbers. These are unique in that they allow the user to specify how many digits of precision they would like stored.

Regular single and doubles precision numbers are allocated a fixed amount of space in memory, 32 and 64 bits respectively and hence are limited to about 8 or 16 decimal digits of precision. Unlimited or infinite precision numbers on the other hand occupy different amounts of memory depending on the number being stored. These terms however are misnomers since the number of digits that can be stored, while very large is always finite and limited by software and memory constraints.

Arbitrary precision numbers are useful in many specialized tasks from scientific computing to cryptography. The cryptography used for securing web transactions for example often requires working with thousand plus digit numbers. In mathematics they are used when calculating the value of constants such at pi or the square root of 3. Sometimes, to see the impact of rounding errors, it may be useful to perform the same calculation in standard precision and again in extended precision. Drawing fractals in high magnification is another task that benefit from higher precision numbers. Applications where the output is viewed by humans and speed is not a concern, extended precision may also make sense.

Extended precision numbers can mitigate the many types of failures that can result from bad numerical programming. Disasters written about extensively in earlier posts such as failing rockets may have been averted by the usage of higher precision numbers. Big integers for example can prevent overflow errors. Big floating point numbers mitigate the impact of catastrophic cancellation that results from subtracting two similar numbers and can sometimes help address the issue of range reduction.

Bignum classes are built into many progra    mming languages. Java for example has the BigInt and BigFloat classes. specific classes exist in many languges to For example when calculating pi to many decimal places, regular single and double precision numbers are not sufficient.

There is however a cost to the use of arbitrary precision numbers and hence their limited usage. Computer hardware is optimized to store and operate on either single precision or double precision numbers. For example, graphics cards are designed to perform operations on arrays of single precision numbers since pixel colors can be fully represented with only 32 bits.

Thus working with extended precision numbers necessitates the use of software to perform simple operations which can be much slower. Efficient algorithms have been developed to perform common mathematical operations. Addition and subtraction are relatively easy and can be accomplished in O(n) time where n is the number of digits of precision involved. Multiplication is surprising complicated and many algorithms with different time complexity exist. Algorithms with complexity from O(n²) to O(n log n 2log* n) exist.

http://en.wikipedia.org/wiki/Bignum

http://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations

Posted in Topics: Uncategorized

Jump down to leave a comment.

Leave a Comment

You must be logged in to post a comment.



* You can follow any responses to this entry through the RSS 2.0 feed.