--------------------------------------------------------------------------------------- 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 accept string arguments, and also return a string. Only the function 'PRECISION', defining how many bits are used by GMP to carry a floating point value, accepts a numeric value. Peter van Eerten, September 2009 - GPL. --------------------------------------------------------------------------------------- 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$ 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$ --------------------------------------------------------------------------------------- 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$