Extended Plugin
Extended Plugin for REALbasic adds five new data types. They are:
ExtInteger
ExtFloat
ExtComplex
IAExtFloat
ExtFraction
ExtInteger is the type ZZ of Victor Shoup's multi-precision library, NTL. Except for available memory, there is no limitation on the size of an ExtInteger. So you can multiply a 100 digit integer by another 100 digit integer giving the exact 200 digit integer.
ExtFloat is the type RR of NTL. You can set both the bit precision and the decimal output precision for ExtFloat, with no limitation except for available memory. It might take awhile, but you can now calculate pi in a REALbasic program to a million decimal places, or more. The power of 10 for ExtFloat can range from about -60,000,000 to +60,000,000 as compared to -308 to +308 for a Double.
ExtComplex doesn't exist in NTL. I made it from two ExtFloats. So the real and imaginary parts of an ExtComplex use the bit precision and the decimal output precision set for ExtFloat. So you can now use complex numbers with almost unlimited precision.
IAExtFloat also doesn't exist in Victor Shoup's NTL. It is a data type which is used for Interval Arithmetic, which is arithmetic with inequalities. An IAExtFloat number is represented by two ExtFloat numbers (a, b), where one thinks of an ExtFloat number x being in the interval between a and b. That is: a <= x <= b. For a function of x calculated with interval arithmetic the result is an IAExtFloat whose interval (fa, fb) results from interval propagation.
ExtFraction handles a fraction as num/den, where num and den are ExtIntegers. Thus one can do exact calculations with rationals in REALbasic to an almost unlimited degree.
Extended Plugin itself allows you to construct programs which can handle the five new data types much like doubles and integers are handled. To a large extent the seven data types can be freely used with the +, -, *, and / operators, except that IAExtFloat does not mix with ExtComplex, and ExtFractions can mix only with Integers and ExtIntegers. And most of REALbasic's functions have been overloaded to take the five new data types, where it makes sense to do so.
As a Mac OS X Universal, x86, and Linux plugin, it can be used to build Mac OS X Universal, Windows, and Linux applications.
Version 0.91 corrects a bug in Compare for ExtComplex.
Version 0.92 gets around an ATSUI bug in OS X by inserting a line break every 1000 characters in an output string. This fix is only in the Carbon portion of the plugin.
Version 0.93 corrects a strange bug in the Pow function when the base is 2.
Version 0.94 adds NTL's pseudo-random number generator whichh generates an ExtFloat in the range 0 to 1.
Version 1.0.1 corrects a minor problem with the complex Pow function.
Version 1.1 adds the functions Round, Floor, Ceil, and Trunc for the ExtFloat type.
Version 1.2 converts a double to an ExtFloat with the maximum possible accuracy.
Version 1.2.1 adds the Equate function.
Version 1.3 adds the IAExtFloat type.
Version 1.3.1 adds the function IsItPrime, which uses the Miller-Rabin Test to determine if an ExtInteger is probably prime, or definitely not prime.
Also added is the function ExtIntRandom, which generates a random ExtInteger of user selected length.
Version 1.3.2 adds the function gcd(x, y). It returns the greatest common divisor of two ExtIntegers.
Version 1.3.3 adds the function RoundToPrecision(x, p). It returns the ExtFloat x rounded to bit precision p.
Version 1.5 adds the ExtFloat functions: Add, Subtract, Multiply, and Divide. These can speed up code execution, but result in mutable objects. Read the description file before using.
Version 1.6 adds the Equate function for ExtFloats. This also is a mutable function.
Version 2.0 adds the ExtFraction type.
Version 2.0.1 corrects a bug where z.Str might change the ExtFraction z.
Version 2.1 adds eight functions for doing modular arithmetic with ExtIntegers.
Version 2.2 renames Extended Plugin exceptions so as to be compatible with REALbasic 2005.
Version 2.3 allows base conversion of a number string for bases from 2 to 36. Some inputs for PowerMod are no longer flagged as errors.
Version 2.4 allows base conversion of a number string (including decimal or base point numbers) for bases from 2 to 65536.
Version 3.0 adds support for creating Mac OS X Universal applications with REALbasic 2006 Release 4.
Version 3.1 adds the functions ShiftLeft and ShiftRight which do binary shifting of ExtIntegers. This provides rapid multiplication or division of an ExtInteger by an integer power of two.
Version 3.2 adds Linux support.
Version 3.3 improves exception handling. It also has a faster gcd function.
Version 3.4 is now compatible with the latest versions of REALbasic.
Extended Plugin was programmed in C++ and compiled with Xcode 3.0 and gcc 4.1.2.
NTL is free software, and may be used according to the terms of the GNU General Public License. A copy of the required license is included with Extended Plugin.
Freeware.
Download Extended Plugin v 3.4. The download includes documentation and REALbasic projects for testing the plugin.
ExtendedPlugin.zip (908 KB)
The Linux source files for Extended Plugin can be downloaded here:
ExtendedPluginSource.zip (1.2 MB)