1
$\begingroup$

When the calculator displays the digits of $\pi$, how does it arrive at that answer? Also, at what digit does the approximation of $\pi$ stop at?

  • 0
    Relevant? http://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula2012-05-01

2 Answers 2

10

I'm not an expert in calculators, but here's my understanding: The calculator doesn't calculate $\pi$. It has a numerical approximation programmed in, up to some degree of precision which is almost certainly more than the number of decimal places that fit in the display. Then it treats $\pi$ like any rational constant. If you want to see how far your calculator goes, here's what you can do:

First, enter $\pi$ into your calculator. Subtract 3. Multiply by 10. Subtract 1. Multiply by 10. Subtract 4, multiply by 10, subtract 1, multiply by 10, etc, getting rid of more and more digits. Eventually you'll run out of digits, get 0, or hit some other other sort of error. If you keep track of how many steps this takes, you'll find out how many digits of $\pi$ your calculator has "memorized."

  • 1
    Indeed, constants in most calculators are cached and not computed. To use the TI-83 Plus as an example: try `π-3.1415926`. Actually, that makes for a slightly more efficient technique than Brett's: output the constant, note how many digits are displayed, and subtract from the constant an approximation from the digits displayed. Note how tiny the result is and how many digits are displayed.2012-05-01
6

There's a difference between idealized mathematics and the real world calculations which require definite answers of some precision (significant digits), $\pi$ is not only irrational, it is transcedental. The computer resoloves down to a $n$-bit approximation, which is mostly impeded only by register size and the actual design of the microprocessor that powers it. It is simply a constant floating point value of varying bit-depth and is treated as such.

You can do lots of clever tricks and processing, creating huge-digit numbers which can be intrepreted by the software in terms of multiple bytes banded together ( even though it crosses register size ). But at the end of the day, every attempt to have $\pi$ naturally in the system, as an irrational and transcendental constant it is, is impossible. Computers are fundamentally deterministic and finite.

The precision varies from financial calculators, home calculators to scientific calculators. Also, defer back to hardmath's comment, CORDIC routines are interesting when the given implementation of a calculator doesn't have a hardware multiplier.

In the end: It is represented as a finite constant approximation of varying bit-depth depending on the platform it is implemented on and stored in the varying size ROM. Example, iPhone's Calculator PI constant is at around ~17 digits (bear in mind that the architecture of the iPhone is much more complex than a calculator and the representation of $\pi$ could be a lot better if you implemented it yourself using clever programming).

  • 0
    One question, how do you express a some number of decimal digits in terms of bits?2012-05-01