June 1, 2005
By Karen Kenworthy
IN THIS ISSUE
A little while ago I tried to perform a simple calculation. I needed to know the value of 2, raised to the 128th power. In other words, I wanted to multiply 2 by itself, a total of 128 times.
You probably know the answer, off the top of your head. But innocently, I asked Windows' Calculator program to help me over the hardest parts of the calculation (the last 127 multiplications).
All seemed fine until the last operation. Suddenly, as I clicked the equal sign for the last time, the calculator's display changed from a reasonable-looking "18,446,744,073,709,551,616" to a bizarre-looking "3.4028236692093846346337460743177e+38"!
What happened? And what does this cryptic "answer" mean?
Little World of Big Numbers
Most of you know what happened. Window's Calculator didn't do anything wrong. It just ran out of space to hold the ever-increasing digits my computations were producing. At some point, it had to save space by converting my data to "scientific notation".
Scientific notation is a handy way to store large numbers. Instead of recording hundreds or thousands of individual digits, only a relative few are retained. In the case of my little math problem, those "significant" digits began with "3", and ended with the last "7". They form this manageable string: 3.4028236692093846346337460743177
The sharp-eyed among us have already noticed something odd. The number we just saw is tiny, only a little more than 3. It should be MUCH larger. In fact, it should be more than:
That's where the peculiar-looking trailing sequence, "e+38", comes to the rescue. What does it mean? A mathematician or engineer might say "multiply the significant digits by 10, raised to the 38th power".
But most of wouldn't say a word. We'd simply look at the number that follows the letter "e". If it's positive, the decimal point, found among the significant digits, gets moved to the right. If the number after the letter "e" is negative, we move the decimal point to the left.
How far would we move this little point? The number after "e+" or "e-" lets us know. It shows the number of digits the decimal point should slide, either left or right.
Now we can decode Windows' Calculator's display. Thanks to the magic of scientific notation, we now know the value of 2, raised to the 128th power! The number I was seeking is:
Sadly, that's not correct. While saving space, Windows' Calculator also economized on accuracy. The last eight digits of its answer, including one that appears at the end of the original "significant" digits, are wrong. The correct result is exactly:
Windows' Calculator is only "a little off", if you consider 8,788,544 small. But as numbers grow, the compromises of scientific notation get worse.
For example, consider what happens when Windows' Calculator is asked to multiply 2 times itself, a measly 288 times. The answer given by the Calculator looks impressive, until you realize the last 48 digits are incorrect! The error, or difference between the answer given, and the correct value, is a whopping:
Now, truth be told, numbers this size are very seldom crunched by mainframe computers, let alone little calculators. So what if a few crumbs get lost along the way? Windows' Calculator can accurately balance Bill Gates' checkbook, and perform other mega- and giga-calculations. In fact, for most of us, most of the time, the errors introduced by scientific notation aren't an issue.
But, as both my parents will tell you, I'm curious and stubborn. For a long time I've wondered if a more accurate calculator could be created. Was a program that could add, subtract, multiply and divide numbers of truly enormous size -- containing hundreds, thousands, even tens of thousands of digits -- possible? And if one existed, would anybody care?
The answer to the first question is now "Yes". A highly accurate calculator program now exists. It's my newest Power Tool, a little program called, naturally enough, Karen's Calculator!
When you run this program, the window it displays is familiar enough. You'll see buttons for each digit, 0 through 9. Other buttons bear the symbols "+", "-", "*" and "/". As you'd expect, clicking those buttons order the calculator to add, subtract multiply, or divide.
You'll see a few less-common calculator buttons too. One immediately "squares" (raise to the second power) any number. Another computes the "cube", or raises the number to the third power.
Two more buttons instantly recall famous, and useful, constants -- Pi and Euler's Number (e). The calculator even has a memory, where you can store any other number that interests you.
But what makes my Calculator unusual, maybe even unique, is its ability to accurately process really large numbers. And I do mean "REALLY LARGE NUMBERS".
Need to add two 100-digit numbers? No problem. My Calculator will instantly provide the answer, accurate to the last digit. Want to multiply two 1,000-digit numbers? No problem. The calculation will take a moment longer. But when it appears, the result won't be missing any digits -- or accuracy.
With a little patience, you can even compute values containing 10,000 digits, or more. My record is squaring a number containing 18,807 digits. The result took 6 minutes, 25 seconds to compute, and contained a total of 37,614 digits! But they're all accurate -- as far as I know. :)
There's a lot more to say about my new calculator. But it'll have to wait until we meet again. In the meantime, if you want to put this new brain through its paces, visit its home page at:
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:
Until next time, may all your math -- and other -- problems be small. And if you see me on the 'net, be sure to wave and say "Hi!"
Power Tools Newsletter
- Please don't click SPAM.
- Windows-Key Searching
- Disabling Web Search
- Karen's Directory Printer v5.4.3 Released
33033 Verified Subscribers
Subscribe to receive new issues of the newsletter about Karen and her free Power Tools.Click here to Subscribe