Article Preview
Buy Now
REVIEW
MPCalc Plugin
Issue: 1.1 (August/September 2002)
Author: Jim Rodovich
Article Description: No description available.
Article Length (in bytes): 3,811
Starting Page Number: 9
Article Number: 1021
Related Link(s): None
Excerpt of article text...
Chances are if you need to do some math calculations with REALbasic, doubles can hold numbers as large or small as you'll require. However, if you need to get very precise answers, in some cases a double might not be sufficient. Typically, numbers represented by doubles are accurate for about the first sixteen digits. Anything to the right of the sixteenth digit is most likely inaccurate. This means that if you're using a double to store a number that's in excess of one quadrillion, you can expect any values after the decimal point to be incorrect.
Fortunately, you won't need to forsake modern technology and resort to using paper and a pencil when you're dealing with highly precise numbers. Instead, you can use MPCalc, a freeware REALbasic plugin that can perform calculations on numbers with up to thirty thousand digits. You can even set the precision yourself, so if you just need twenty digits, your program won't be chugging along calculating 29,980 unnecessary digits.
The MPCalc plugin operates using what is known as the Reverse Polish Notation (RPN). This is somewhat different from what you're probably used to, but it's a small adjustment. In an expression written in RPN, both numbers are written before the operator. For example, instead of writing 1 + 2, you would write 1 2 + in RPN. It's a different way of thinking, but with a little practice, even expressions with several operations are easy to state in RPN.
...End of Excerpt. Please purchase the magazine to read the full article.