June 15, 2005

By Karen Kenworthy

IN THIS ISSUE

This was the second time my 6th grade math teacher would change my life.

It was late in the day, late in the school year too, when everyone's thoughts were far away. The inaudible hum that seduces students with promises of sleep drifted through the warm, still air of the classroom. Armed with nothing more powerful than his voice and a piece of chalk, Mr. Miller valiantly fought to impart some obscure bit of mathematical lore -- something I'd come to use everyday of my life, if only I'd paid attention.

I was moments away from surrendering to the temptation of sleep when, like lightening, one word vaporized the fog enveloping me. "Infinity", Mr. Miller said, in a context I do not remember, and probably never heard.

But I'll never forget our conversation that followed. He patiently answered all the questions that flooded into my 11 year old mind. And he planted there an interest in the more abstract areas of mathematics that quickly grew, and has never withered.

### Infinity

Unlike such notions as "least common denominator" or "multiplicand", the mathematical concept of "infinity" fascinates me. It belongs to a mysterious realm outside our normal experience. It breaks all the rules.

Subtract one infinity from another. What's left? Infinity. Divide any number you can imagine into infinity. What's the result? Another infinity. And so it goes. Infinity is the real bad boy of mathematics.

Lest you think infinity never intrudes on our day-to-day lives, consider the circle. As I'm sure you know, mathematicians call the ratio of its circumference to its diameter "Pi". No matter how large, or small, the circle, the value of Pi is always approximately 3.

That means that a trip around the outside of a circle (its circumference) is approximately three times longer than a shortcut across its middle (its diameter).

But the value of Pi isn't exactly 3. A more accurate approximation is 3.141592654. But that's not the correct value either. And neither is 3.141592653589793238462643383279502884197169399375105820974944592307816406 286208998628034825342117068, though it's a bit closer.

What is the exact value of Pi? The truth is, no one knows. That's because it contains an infinite number of digits. Even though Pi has been calculated with an accuracy of over one trillion digits, the end is no where in sight.

Pi isn't the only number that's impossible to pin down. Other mathematical constants, such as e (Euler's Number -- the "base of natural logarithms" also requires an infinite number of digits to express precisely. The same is true for some very common numbers, such as one-third (1 divided by three, or .33333333333 ad infinitum).

### Adjustable Precision

I came face to face with infinitely long numbers when creating my newest program, Karen's Calculator. As you may recall, it's a fairly standard calculator with one big difference -- it can process really large numbers, containing hundreds, thousands, even tens of thousands of digits.

One encounter with infinity is common to all calculators. What happens when someone asks a machine to divide a number by zero? If the calculator isn't careful, it can waste a lot of time trying to arrive at the infinite result. But, like other calculator's, mine short-circuits the process and immediately reports an error ("Divide by Zero").

The second brush with infinity isn't so easy to deal with. Some perfectly reasonable calculations result in a very large, and sometimes even infinite, number of digits. We saw this a moment ago, when we divided one by three (1 / 3), and produced an infinite number of new threes (.33333 ...).

Calculations that yield an infinite number of digits are a serious problem for calculator designers. Even with the fastest computer, completing such a computation would take an infinite amount of time. Few people would be willing to wait that long. I know I have other plans.

Most calculators "solve" this problem by computing a reasonable number of digits, displaying those, and ignoring the rest. This works fine if the digits revealed are all you need.

But my calculator had to do better. That's why it allows you to choose the number of digits you want to see, when a full computation would produce too many.

To make that choice, look for the "Quotient Precision" entry on the program's Options menu. There you'll see four choices:

One choice, "25 digits", rounds the results of division to 25 significant digits, if the full result would have contained more than 25 digits.

Two other choices are "50 digits" and "100 digits". I'll let you guess what they mean. :)

And you probably know what the fourth choice, "Custom", means too. It lets you tell the program exactly how many digits you're willing to see. The minimum is 1, and the maximum is 10,000.

My calculator must deal with infinity in one other way. Two of its keys instantly recall the values of the mathematical constants Pi and "e". But as we saw a moment ago, all values of these special numbers are really finite approximations of infinitely long numbers.

How precise are my Calculator's approximations of Pi and "e"? How many digits do they contain?

Once again, you get to answer that question. On the calculator's Options menu is another entry that reads "Pi and e Precision". Select it and you'll see the same four choices we talked about a moment ago: "25 digits", "50 digits", "100 digits", and "Custom".

The first three choices behave as you'd expect -- limiting values of Pi or "e" to 25, 50, or 100 digits. And as before, "Custom" allows you to specify any number of digits, between 1 and 10,000.

### Limits

The truth is, I don't know how many digits my calculator can digest. In theory, the limit is a little over two billion digits, because of some design decisions I made.

But realities, including the details of computer memory allocation, and the amount of memory possessed by a particular computer, impose a lower limit. I suspect the practical limit is around a million digits, but so far I haven't performed a calculation that would put that to the test. :)

So, why did I limit quotients to "just" 10,000 digits? It's an arbitrary choice. Longer quotients take more time to compute. And on most modern computers, 10,000 digits seems a reasonable choice.

But if your computer is super-fast, or you just need more accuracy when you divide, there is a way around this limit. The newest version of my calculator looks for a special entry in the Windows Registry. If present, the entry's value overrides the default limit of 10,000 digits.

[Nerdy Alert: If you aren't comfortable adding new entries to your Registry, consider living with 10,000-digit quotients. Or find someone who is comfortable adding new entries to your Registry.]

The name of the Registry value is MaxQuotientPrecision. It should be a "DWORD" value, located under this Registry key:

HKEY_CURRENT_USER\Software\KarenWare\Power Tools\Calc

Feel free to assign any value between 1 and 1,000,000. Values outside this range will be silently ignored, resulting in the default limit of 10,000 digits.

The calculator's values of Pi and "e" are limited to 10,000 digits each for a different reason. Each digit adds one byte to the size of the calculator program's size.

If there's enough demand, I can increase the maximum accuracy of Pi and "e" to one million digits, or more. But for the moment, I suspect 10,000 digits of accuracy will meet most needs. :)

There's a bit more to say about my new calculator. But until we meet again, give the new calculator a try. I think you'll like many of its new features. You can download your copy from its home page at:

https://www.karenware.com/powertools/ptcalc

As always, the program is free for personal/home use. If you're a programmer, you can download its complete Visual Basic source code too!

You can also get the latest version of every Power Tool, including the new Calculator, on a shiny CD. These include three bonus Power Tools, not available anywhere else. The source code of every Power Tool, every issue of my newsletter, and some articles I wrote for Windows Magazine, are also on the CD. And owning the CD grants you a special license to use all my Power Tools at work.

Best of all, buying a CD is the easiest way to support the KarenWare.com web site, Karen's Power Tools, and this newsletter. To find out more, visit:

https://www.karenware.com/licenseme

Until next time, be careful to stay away from those bothersome interstellar black holes (points where the density of matter may be infinite). And if you see me, or Mr. Miller, on the 'net, be sure to wave and say "Hi!"

### Power Tools Newsletter

- Shift Right-Click
- Replicator Updated
- Text-Only Newsletters

33540 Verified Subscribers

Subscribe to receive new issues of the newsletter about Karen and her free Power Tools.

Click here to Subscribe

### Recently

February 18^{th} Newsletter

()

Karen's Replicator v3.7.4 Released

()

Karen's Replicator v3.7.3 Released

()

Karen's Replicator v3.7.2 Released

()

*Also, there were 6 minor updates completed recently.*