PROJECT INDEX - UDF LIB HOME

MySQL UDF & Plugin Library

(big_integer user defined functions library)
Introduction :

LibBigInt a library which provides a set of functions which supports numbers of any size, represented as strings.
Installation :

There are only a few steps you have to follow, or refer to how to install udf lib :

Requirements :

No Requirements is needed.

This extension makes use of the BIG_INT. BIG_INT is a library which provides a set of functions (API) to handle arbitrary length integers created by Alexander Valyalkin (valyala@gmail.com).

Features of BIG_INT library:

List of functions:
bi_base_convert, bi_add, bi_sub, bi_mul, bi_div, bi_mod, bi_sqr, bi_abs
string bi_base_convert(string big_int_str, int base_from, int base_to)
Function name bi_base_convert
Purpose converts string representation of number big_int_str with base base_from into string representation with base base_to.base_from and base_to can be from 2 to 36 inclusive.
Returns: converted string or NULL on error.
Aggregate function No
Input parameter(s) 3
Conditions -
Output value(s) 1 (STRING)
Examples SELECT bi_base_convert('111110001111111001111111111110111111111111111111', 2, 10);
Registration CREATE FUNCTION bi_base_convert RETURNS STRING SONAME "libbigint.so";
UNINSTALL DROP FUNCTION IF EXISTS bi_base_convert;
goto top

string bi_add(string a, string b)
Function name bi_add
Purpose calculates a + b.
Returns: a + b or NULL on error.
Aggregate function No
Input parameter(s) 2
Conditions -
Output value(s) 1 (STRING)
Examples SELECT bi_add('5778546498156149849843613211694798798465158056164', '1002465511477211');
Registration CREATE FUNCTION bi_add RETURNS STRING SONAME "libbigint.so";
UNINSTALL DROP FUNCTION IF EXISTS bi_add;
goto top

string bi_sub(string a, string b)
Function name bi_sub
Purpose calculates a - b.
Returns: a - b or NULL on error.
Aggregate function No
Input parameter(s) 2
Conditions -
Output value(s) 1 (STRING)
Examples SELECT bi_sub('5778546498156149849843613211694798798465158056164', '1002465511477211');
Registration CREATE FUNCTION bi_sub RETURNS STRING SONAME "libbigint.so";
UNINSTALL DROP FUNCTION IF EXISTS bi_sub;
goto top

string bi_mul(string a, string b)
Function name bi_mul
Purpose calculates a * b.
Returns: a * b or NULL on error.
Aggregate function No
Input parameter(s) 2
Conditions -
Output value(s) 1 (STRING)
Examples SELECT bi_mul('5778546498156149849843613211694798798465158056164', '1002465511477211');
Registration CREATE FUNCTION bi_mul RETURNS STRING SONAME "libbigint.so";
UNINSTALL DROP FUNCTION IF EXISTS bi_mul;
goto top

string bi_div(string a, string b)
Function name bi_div
Purpose calculates a / b.
Returns: a / b or NULL on error.
Aggregate function No
Input parameter(s) 2
Conditions -
Output value(s) 1 (STRING)
Examples SELECT bi_div('5778546498156149849843613211694798798465158056164', '1002465511477211');
Registration CREATE FUNCTION bi_div RETURNS STRING SONAME "libbigint.so";
UNINSTALL DROP FUNCTION IF EXISTS bi_div;
goto top

string bi_mod(string a, string b)
Function name bi_mod
Purpose calculates a % b.
Returns: a % b or NULL on error.
Aggregate function No
Input parameter(s) 2
Conditions -
Output value(s) 1 (STRING)
Examples SELECT bi_mod('5778546498156149849843613211694798798465158056164', '1002465511477211');
Registration CREATE FUNCTION bi_mod RETURNS STRING SONAME "libbigint.so";
UNINSTALL DROP FUNCTION IF EXISTS bi_mod;
goto top

string bi_sqr(string num)
Function name bi_sqr
Purpose calculates num.
Returns: num or NULL on error.
Aggregate function No
Input parameter(s) 1
Conditions -
Output value(s) 1 (STRING)
Examples SELECT bi_sqr('5778546498156149849843613211694798798465158056164'');
Registration CREATE FUNCTION bi_sqr RETURNS STRING SONAME "libbigint.so";
UNINSTALL DROP FUNCTION IF EXISTS bi_sqr;
goto top

string bi_abs(string num)
Function name bi_abs
Purpose
string bi_abs(string num)
calculates abs(num).
Returns: abs(num) or NULL on error.
Aggregate function No
Input parameter(s) 1
Conditions -
Output value(s) 1 (STRING)
Examples SELECT bi_abs('5778546498156149849843613211694798798465158056164'');
Registration CREATE FUNCTION bi_abs RETURNS STRING SONAME "libbigint.so";
UNINSTALL DROP FUNCTION IF EXISTS bi_abs;
goto top