--------------------------------------------------------------------------------------- The GMP library allows calculations with large integer or floating point numbers. The appropriate datatype for BaCon to hold large numbers is STRING. Therefore the GMP functions below mostly accept and return string arguments (except for PRECISION and COMPARE). Peter van Eerten, September 2009 / March 2011 - GPL. --------------------------------------------------------------------------------------- GENERIC FUNCTIONS --------------------------------------------------------------------------------------- INIT - Initialize library when used as Shared Object or when using selective INCLUDE --------------------------------------------------------------------------------------- INTEGER FUNCTIONS --------------------------------------------------------------------------------------- ADD$(p$, q$) Add p$ to q$ and return result SUBSTRACT$(p$, q$) Substract q$ from p$ and return result MULTIPLY$(p$, q$) Multiply p$ by q$ and return result DIVIDE$(p$, q$) Divide p$ by q$ and return result MODULO$(p$, q$) Divide p$ by q$ and return rest value POWER$(p$, q$) Raise p$ to the power of q$ SQUARE$(p$) Root square of p$ ROOT$(p$, q$) Get the q-th root of p$ COMPARE(p$, q$) Compares p$ and q$: p < q returns -1, p == q returns 0, p > q returns 1 FIBONACCI$(p$) Return the Fibonacci number based on p$ FACTORIAL$(p$) Return the factorial of p$ ISPRIME(p$, q) Determines if p$ is a prime number, based on q amount of tests. Returnvalues: 0 = p$ is not a prime, 1 = p$ is probably a prime, 2 = p$ is definitely a prime NEXTPRIME$(p$) Return the next prime value based on p$ GCD$(p$, q$) Find the greatest common divisor of p$ and q$. The result is always positive even if one or both input operands are negative. --------------------------------------------------------------------------------------- FLOAT FUNCTIONS --------------------------------------------------------------------------------------- PRECISION(x) Defines the precision in bits used by GMP for float values FADD$(p$, q$) Add p$ to q$ and return result FSUBSTRACT$(p$, q$) Substract q$ from p$ and return result FMULTIPLY$(p$, q$) Multiply p$ by q$ and return result FDIVIDE$(p$, q$) Divide p$ by q$ and return result FPOWER$(p$, q$) Raise p$ to the power of q$ FSQUARE$(p$) Root square of p$ FCOMPARE(p$, q$) Compares p$ and q$: p < q returns -1, p == q returns 0, p > q returns 1