fp Plugin

Using my own fp multi-precision engine, 32-bit and 64-bit aware fp Plugin for Xojo adds six new data types. They are:


Except for available memory, there is no limitation on the size of a BigInteger. So you can multiply a 100 digit integer by another 100 digit integer giving the exact 200 digit integer.

BigFloat is a multi--precision floating point number. You can set both the internal precision and the decimal output precision for BigFloat, with no limitation except for available memory. It might take awhile, but you can now calculate pi in a Xojo program to a million decimal places, or more. The power of 10 for BigFloat can range from about -600,000,000 to +600,000,000 as compared to -308 to +308 for a Double.

BigComplex is composed of two BigFloats, so it uses BigFloat precision.

BigFraction represents num/den where num and den are BigIntegers.

BigPoly represents a polynomial with BigFraction coefficients.

BigMatrix represents a matrix with BigFraction elements.

fp Plugin itself allows you to construct programs which can handle the six new data types much like doubles and integers are handled. To a large extent the new data types can be freely used with the +, -, *, and / operators, and can be used in comparisons. And most of Xojo's functions have been overloaded to take the new data types, where it makes sense to do so.

The added 7th data type is ComplexVector, which holds an array of complex numbers. Additional functions use the Laguerre method to find for a polynomial all its roots (complex or real) to any chosen precision.

I am releasing fp Plugin with an easy-to-meet license. It is unconditionally available for any use, but is without warranty.

Version 1.1 adds fpNthRoot and fpIsItEven for BigIntegers, and adds fpIsItInteger for BigFloat.

Version 1.2 adds fpFactorial(x) for BigFloat. Depending on the value of x, this is either x! or Gamma(x+1).

Version 1.2.1 adds fpFactorial(x) for BigInteger. The plugin computes x! using its definition. The result is always exact, unless there is overflow.

Version 1.3 has a much faster conversion of a large BigInteger to a String.

Version 1.4 adds the ability for BigIntegers to mix with the types INT64 and UINT64 for arithmetic operations and comparisons.

Version 1.5 adds the ability for BigIntegers to mix with the types INT64, UINT64, UINT32, INT16, UINT16, INT8, and UINT8 for arithmetic operations and comparisons. Many fpEquate functions have been added for conversions between BigIntegers and the REALbasic numeric types, with an exception raised when the conversion is invalid.

Version 1.6 corrects a rare subtraction bug.

Version 2.0 adds Euler's Constant and the Bessel functions for both integer and non-integer orders.

Version 2.1 adds support for Linux.

Version 2.5 adds the Beta Function, the Incomplete Beta Function, the Error Functions, the Exponential Integral, the Fresnel Integrals, and the Confluent Hypergeometric Function.

Version 3.0 adds the BigComplex type. For BigInteger, BigFloat, or BigComplex arguments, it changes the names of the standard functions by prefixing them with "fp". So for a BigFloat argument, x, you should use "fpsqrt(x)" not "sqrt(x)", "fpcos(x)" not "cos(x)", and so on for all the standard functions. Read "fpPlugin Desc.rtf" for an explanation.

Version 3.1 works with OS X 10.4, 10.5, and 10.6.

Version 3.2 corrects a bug in the BigInteger fpRandom function. It also updates the documentation to remove a mistaken reference to a BigFloat fpRandom function.

Version 3.3 adds support for Mac Cocoa.

Version 3.4 adds the function fpExtendedGCD, which implements the Extended Euclidean Algorithm.

Version 3.5 adds the function: fpRandom2(n As Integer) As BigInteger // generates a pseudo-random BigInteger of bit length n

Version 3.6 is console safe. It also adds the function: fpConvBase(numberString As String, baseTo As Integer, baseFrom As Integer, numPlaces As Integer, toUpperCase As Boolean) As String // 2 <= baseTo, baseFrom <= 65536; numPlaces is the limit for the number of base point places in the baseTo number, toUpperCase = true or false outputs upper or lower case

Version 4.0 has functions which use Laguerre's Method to find all the roots of a polynomial to any chosen precision.

Version 4.1 adds the ability to set "Round To Zero" to ON or OFF for the roots of a polynomial.

Version 4.2 adds binary Gray code to the function fpConvBase.

Version 4.3 corrects a bug in the BigFloat function fpIsItInteger.

Version 4.5 allows the bitWise operators And, Or, and Xor to be used between two BigIntegers or between a BigInteger and an Integer. And a number base from 2 to 65,536 can be chosen for input and output of BigIntegers.

Version 4.6 corrects a bug in the fpIsItEven function.

Version 4.7 adds the ability to handle floating point numbers to the fpConvBase function.

Version 4.8 adds the ability to handle fractions to the fpConvBase function.

Version 4.9 adds several bitwise functions for the BigInteger type.

Version 5.0 adds the functions:
fpLnFactorial(x As BigFloat) As BigFloat // this is the natural log of Gamma(x+1) computed using the asymptotic series for ln(Gamma(x+1))
fpBigFactorial(x As BigFloat) As String // This uses fpLnFactorial. Then Gamma(x+1) is generated as a string number with an exponent of 10 which can be much larger than any exponent in a BigFloat.
fpGetNumberFromLog(logNumber As BigFloat) As String // converts the log of a number into a string with that number with an exponent of 10 which can be much larger than any exponent in a BigFloat.

Version 5.1 corrects a bug in fpLnFactorial which limited precision, and gives a better output precision to fpBigFactorial.

Version 5.2 corrects a bug in fpConvBase when the number has an exponent but no base point in the mantissa.

Version 5.3 corrects a bug in fpPowBI(x, y) when y = 0.

Version 5.4 corrects a bug in fpInputPolyWithx which got incorrect signs for some complex coefficients in an x-based polynomial. This also propagated to fpFindPolyRoots.

Version 6.1 adds the BigFraction type which represents num/den where num and den are BigIntegers.

Version 6.2 now allows BigFractions to be compared with other BigFractions and integers.

Version 6.3 calculates more efficiently.

Version 7.2 adds the BigPoly and BigMatrix types.

Version 7.3 adds the function fpPowerMod which can raise a square matrix to a very large integer power modulus an integer which also can be very large.

Version 7.4 corrects a bug in multiplication of a matrix by a scalar.

Version 8.0 is now 32-bit and 64-bit aware.

Version 8.1 is now also 64 bit aware for Linux.

Version 8.2 corrects some memory leaks.

fp Plugin is compiled for Mac OS X, Windows, and Linux.

fp Plugin was programmed in C++ and compiled with Xcode 7.2 for the Mac, MinGW for Windows and Ubuntu for Linux.


Download fp Plugin v 8.2. The download includes documentation and Xojo projects for testing the plugin.

fpPlugin.zip (4.1 MB)

Back To Bob Delaney's Home Page