fp is an Xcode C++ project which implements unlimited length integers, multi-precision floating point numbers, fractions with unlimited length integers as num/den, multi-precision complex numbers, rational polynomials, and integer, rational, floating point, and complex matrices. It can calculate the usual transcendental functions, including the Gamma function and other special functions. I am releasing it without a restrictive license.

fp 2.0 corrects bugs in the overloading of operators +, -, *, /, etc.

fp 2.5 corrects a rare subtraction bug.

fp 3.0 adds Euler's Constant and the Bessel functions. It improves fpNormalize and rewrites fpCompareAbs.

fp 3.1 fixes a bug which rarely causes a crash.

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

fp 4.0 adds multi-precision complex numbers. Many functions are overloaded to take the fpComplex numbers as arguments. But of the special functions, only the gamma function has been overloaded.

fp 4.1 fixes a bug in the mbRandom function.

fp 4.2 adds extendedGCD function, which implements the Extended Euclidean Algorithm.

fp 4.3 adds binary Gray code (as base 1) to the bases 2 through 65536 in converting from one base to another.

fp 4.4 corrects a bug in the function isItInteger.

fp 4.5 adds the bitwise operators &, |, and ^ (AND, OR, XOR) for type mb integers.

fp 4.6 corrects a bug in the isItEven function.

fp 4.7 adds the ability to handle floating point numbers to BaseFromBase.

fp 4.71 corrects a bug in BaseFromBase which affected floating point numbers for bases greater than 36.

fp 4.8 adds the ability to handle fractions in BaseFromBase.

fp 4.9 adds new bitwise functions for the mb type.

fp 5.0 adds these functions:
char* GetNumberFromLog(const fp& x) // x should be log(number); this returns a string with that number, even if it wouldn't fit into an fp type.
void LnFactorial(fp& z, const fp& x) // gives z = ln(Gamma(x+1)) using the asymptotic series with Bernoulli Numbers
char* TenToLogTenFactorial(const fp& x) // uses above functions to return a string number for x! which can have an exponent of 10 which may be much larger than any exponent of the fp type

fp 5.1 corrects a bug in LnFactorial which limited precision, and gives a better output precision to TenToLogTenFactorial.

fp 5.2 corrects a bug in BaseFromBase when the number has an exponent and the mantissa has no base point.

fp 5.3 corrects a bug in inputPoly_x which got incorrect signs for some complex coefficients in an x-based polynomial.

Version 6.0 adds the bf type which represents the fraction num/den in which both num and den are the type mb, which represents an unlimited length integer.

Version 6.1 corrects for type fp a string output bug where the last couple of digits might be wrong for high precision outputs.

Version 6.2 calculates more efficiently.

Version 7.0 adds the poly type for rational polynomials and the matq type for rational matrices.

Version 7.1 has bug fixes, including one for isItPrime.

Version 7.2 corrects a bug in divEuclid.

Version 7.3 adds the powerMod function which can raise a square matrix to a very large integer power modulus an integer which also can be very large. There are bug fixes for the mb operators "operator<< (INT32)" and "operator>> (INT32)".

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

Version 7.5 adds the matrix function LUdecomp(A, P, L, U), which performs the Doolittle LU decomposition of the rational square matrix A (A = PLU) with P a permutation matrix. A memory leak was found and corrected.

Version 8.0 is 64 bit compatible.

Version 10.0 adds new matrix types and expands the poly functions to generate primitive polynomials and their GF(p^m) fields. Most (if not all) memory leaks have been stopped.

Version 10.1 can calculate the eigenvectors and eigenvalues of any square matrix at any chosen precision. It also can compute the rank of any matrix.


Download fp v 10.1. The download includes documentation.

fp.zip (664 KB)

Back To Bob Delaney's Home Page