FreeAdhocUDF for InterBase and FireBird in deutschin englishen françaisen españolin italianoa português
homeprevious pageÜbersicht • overview • aperçunext pagelast page Seite empfehlen • advice website •Umfrage • poll • sondage mailing-listwas ich vermisse • what I missed •eMail Kommentar • eMail commentprintsitemap
Numeric-functions 72 functions
Create 4 functions
Format 11 functions
Calculate 20 functions
Compare 4 functions
Binary functions 8 functions
Trigonometry 25 functions
since FireBird 2.1 this function is substitutable with a native SQL statement
Output RETURN mechanism if nothing other is published: FREE_IT
TestSQLs with NULL run only in FireBird 2.
 
Numeric-functions: Create
F_RAND input/output-compatibility to ib_udf
substitutable with RAND
Entrypoint f_rand
Input without

Output DOUBLE floatingpoint-random-number with value between 0 and 1
This function can create more than one different random-no. in one second because the generator is set with the actual systemtime and the process-ID, so that is is impossible, that 2 calls in the same second return the same random-no.
TestSQL
SELECT F_RAND() FROM RDB$DATABASE;
nach oben • go top •
F_INTRANDOM function from adhoc
Entrypoint intrandom
Input INTEGER
INTEGER
min. value of random-no.
max. value of random-no.
Output INTEGER integer-random-no. with value between parameter 1 and parameter 2
This function can create more than one different random-no. in one second because the generator is set with the actual systemtime and the process-ID, so that is is impossible, that 2 calls in the same second return the same random-no.
TestSQL
SELECT F_INTRANDOM(100, 10000) FROM RDB$DATABASE;
SELECT F_INTRANDOM(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_GETRANDOM input/output-compatibility to rFunc (GETRANDOM)
Entrypoint getrandom
Input INTEGER
max. number of random
Output INTEGER integer-random number between 0 and value of parameter 2
This function can create more than one different random-no. in one second because the generator is set with the actual systemtime and the process-ID, so that is is impossible, that 2 calls in the same second return the same random-no.
TestSQL
SELECT F_GETRANDOM(10000) FROM RDB$DATABASE;
SELECT F_GETRANDOM(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_DOUBLERANDOM function from adhoc
Entrypoint doublerandom
Input INTEGER
INTEGER
min. value of random-no.
max. value of random-no.
Output DOUBLE floatingpoint-random-number with value between parameter 1 and parameter 2
This function can create more than one different random-no. in one second because the generator is set with the actual systemtime and the process-ID, so that is is impossible, that 2 calls in the same second return the same random-no.
TestSQL
SELECT F_DOUBLERANDOM(100, 10000) FROM RDB$DATABASE;
SELECT F_DOUBLERANDOM(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
 
Numeric-functions: Format
F_ROUND input/output-compatibility to FreeUDFLibC
Entrypoint f_round
Input DOUBLE floatingpoint to be round as an integer
Output INTEGER integer
The method of rounding is the common method like F_ZAHLRUNDEN.
Because there is a same-named function in C we must change the entrypoint from round to f_round. Therefore now NO entryppoint-compatibility to FreeUDFLibC.
TestSQL
SELECT 16 AS ISCORRECT, F_ROUND(15.567) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_ROUND(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_ROUNDFLOAT compatibility FreeUDFLib, FreeUDFLib AvERP
Entrypoint roundfloat
Input DOUBLE
DOUBLE
floatingpoint to be round
output pattern for floatingpoint (e.g. 0.01) rounds on the next multiple of    parameter 2
Output DOUBLE floatingpoint
TestSQL
SELECT 15.55 AS ISCORRECT, F_ROUNDFLOAT(15.567, 0.05) FROM RDB$DATABASE;
SELECT 15.56 AS ISCORRECT, F_ROUNDFLOAT(15.567, 0.02) FROM RDB$DATABASE;
SELECT 15.57 AS ISCORRECT, F_ROUNDFLOAT(15.567, 0.01) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_ROUNDFLOAT(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_ZAHLRUNDEN
F_ROUNDCOMMON
compatibility FreeUDFLib AvERP, GrUDF
input/output-compatibility to rFunc (ROUND)
substitutable with ROUND
Entrypoint zahlrunden
Input DOUBLE
INTEGER
floatingpoint to be round
number of digits to be round
Output DOUBLE floatingpoint rounded (trading method)
Common Round (from Wikipedia http://en.wikipedia.org/wiki/Rounding):
This method is commonly used, for example in accounting. It is the one generally taught in basic mathematics classes.
    * Decide which is the last digit to keep.
    * Increase it by 1 if the next digit is 5 or more (this is called rounding up)
    * Leave it the same if the next digit is 4 or less (this is called rounding down)
Examples:
    * 3.044 rounded to hundredths is 3.04 (because the next digit, 4, is less than 5).
    * 3.046 rounded to hundredths is 3.05 (because the next digit, 6, is 5 or more).
    * 3.0447 rounded to hundredths is 3.04 (because the next digit, 4, is less than 5).
Negativ numbers are rounded like their absolute values:
    * −2,1349 to −2,13 €
    * −2,1350 to −2,14 €
TestSQL
SELECT 14.5 AS ISCORRECT, F_ZAHLRUNDEN(14.4935, 1) FROM RDB$DATABASE;
SELECT 14.49 AS ISCORRECT, F_ZAHLRUNDEN(14.4935, 2) FROM RDB$DATABASE;
SELECT 14.494 AS ISCORRECT, F_ZAHLRUNDEN(14.4935, 3) FROM RDB$DATABASE;
SELECT 14.4935 AS ISCORRECT, F_ZAHLRUNDEN(14.4935, 6) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_ZAHLRUNDEN(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_ROUNDTOEVEN function from adhoc
Entrypoint roundtoeven
Input DOUBLE
INTEGER
floatingpoint to be round
number of digits to be round
Output DOUBLE floatingpoint rounded (round to even method)
Round to even (from Wikipedia http://en.wikipedia.org/wiki/Rounding):
This method is also known as statistician's rounding or as bankers' rounding. It is identical to the common method of rounding except when the digit(s) following the rounding digit start with a five and have no non-zero digits after it. The new algorithm is:
    * Decide which is the last digit to keep.
    * Increase it by 1 if the next digit is 6 or more, or a 5 followed by one or more non-zero digits.
    * Leave it the same if the next digit is 4 or less
    * Otherwise, all that follows the last digit is a 5 and possibly trailing zeroes; then change the last digit to the nearest even digit. That is, increase the rounded digit if it is currently odd; leave it if it is already even.
With all rounding schemes there are two possible outcomes: increasing the rounding digit by one or leaving it alone. With traditional rounding, if the number has a value less than the half-way mark between the possible outcomes, it is rounded down; if the number has a value exactly half-way or greater than half-way between the possible outcomes, it is rounded up. The round-to-even method is the same except that numbers exactly half-way between the possible outcomes are sometimes rounded up—sometimes down.
Although it is customary to round the number 4.5 up to 5, in fact 4.5 is no nearer to 5 than it is to 4 (it is 0.5 away from either). When dealing with large sets of scientific or statistical data, where trends are important, traditional rounding on average biases the data upwards slightly. Over a large set of data, or when many subsequent rounding operations are performed as in digital signal processing, the round-to-even rule tends to reduce the total rounding error, with (on average) an equal portion of numbers rounding up as rounding down. This generally reduces the upwards skewing of the result.
Round-to-even is used rather than round-to-odd as the latter rule would prevent rounding to a result of zero.
Examples:
    * 3.016 rounded to hundredths is 3.02 (because the next digit (6) is 6 or more)
    * 3.013 rounded to hundredths is 3.01 (because the next digit (3) is 4 or less)
    * 3.015 rounded to hundredths is 3.02 (because the next digit is 5, and the hundredths digit (1) is odd)
    * 3.045 rounded to hundredths is 3.04 (because the next digit is 5, and the hundredths digit (4) is even)
    * 3.04501 rounded to hundredths is 3.05 (because the next digit is 5, but it is followed by non-zero digits)
Negativ numbers are rounded like their absolute values:
    * −2,35 rounded to tenths is −2,4
    * −2,45 (exact) rounded to tenths is −2,4
    * −2,4500001 rounded to tenths is −2,5
    * −2,46 rounded to tenths is −2,5
    * −2,449 rounded to tenths is −2,5
TestSQL
SELECT 3.02 AS ISCORRECT, F_ROUNDTOEVEN(3.016, 2) FROM RDB$DATABASE;
SELECT 3.01 AS ISCORRECT, F_ROUNDTOEVEN(3.013, 2) FROM RDB$DATABASE;
SELECT 3.02 AS ISCORRECT, F_ROUNDTOEVEN(3.015, 2) FROM RDB$DATABASE;
SELECT 3.04 AS ISCORRECT, F_ROUNDTOEVEN(3.045, 2) FROM RDB$DATABASE;
SELECT 3.05 AS ISCORRECT, F_ROUNDTOEVEN(3.04501, 2) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_ROUNDTOEVEN(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_SOFTROUND input/output-compatibility to rFunc (SOFTROUND)
Entrypoint softround
Input DOUBLE
INTEGER
floatingpoint to be round
number of digits to be round
Output INTEGER floatingpoint rounded ti integer
The method of rounding is the common method like F_ZAHLRUNDEN.
If the result of rounding would be 0, than the result is the non-rounded value.
TestSQL
SELECT 0.0016 AS ISCORRECT, F_SOFTROUND(0.0016, 2), F_ZAHLRUNDEN(0.0016, 2) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_SOFTROUND(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_FIXEDPOINT compatibility FreeUDFLib, FreeUDFLibC, FreeUDFLib AvERP
Entrypoint fixedpoint
Input DOUBLE
INTEGER
floatingpoint to be round
number of digits to be round
Output CSTRING(32) floatingpoint as a string
The method of rounding is round to even like F_ROUNDTOEVEN.
In difference to F_ZAHLRUNDEN the output is a String!
In string-expenditure the decimal-separator is a "."
TestSQL
SELECT '12345.5' AS ISCORRECT, F_FIXEDPOINT(12345.46, 1) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_FIXEDPOINT(NULL, NULL) FROM RDB$DATABASE;   
nach oben • go top •
F_FIXEDPOINTLANG function from adhoc
Entrypoint fixedpointlang
Input DOUBLE
INTEGER
CSTRING(1)
CSTRING(1)
floatingpoint to be round
number of digits to be round
Indicator of decimal-separation
Indicator of thousands seperator
Output CSTRING(32) floatingpoint as a string with defined decimal- and thousands separation
The method of rounding is the common method like F_ZAHLRUNDEN.
TestSQL
SELECT '12.345,5' AS ISCORRECT, F_FIXEDPOINTLANG(12345.46, 1, ',', '.') FROM RDB$DATABASE;
SELECT '12.345' AS ISCORRECT, F_FIXEDPOINTLANG(12345.46, 0, ',', '.') FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_FIXEDPOINTLANG(NULL, NULL, NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_TRUNCATE compatibility FreeUDFLib, FreeUDFLibC, FreeUDFLib AvERP, GrUDF
substitutable with TRUNC
Entrypoint f_truncate
Input DOUBLE floatingpoint to be truncat
Output INTEGER integer
TestSQL
SELECT 15 AS ISCORRECT, F_TRUNCATE(15.567) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_TRUNCATE(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_DOLLARVAL
F_CONVERTTODOLLAR
compatibility FreeUDFLib, FreeUDFLib AvERP
compatibility FreeUDFLibC
Entrypoint dollarval
Input DOUBLE floatingpoint
Output CSTRING(32) Dollar-floatingpoint ($ in front of the number) (rounded to 2 digits)
TestSQL
SELECT '$15.68' AS ISCORRECT, F_CONVERTTODOLLAR(15.678) FROM RDB$DATABASE;
SELECT '$15.68' AS ISCORRECT, F_DOLLARVAL(15.678) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_DOLLARVAL(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_EUROVAL function from adhoc
Entrypoint euroval
Input DOUBLE floatingpoint
Output CSTRING(32) EURO-floatingpoint (EUR after the number) (rounded to 2 digits)
TestSQL
SELECT '15.47 EUR' AS ISCORRECT, F_EUROVAL(15.47) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_EUROVAL(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_NUMINWORDS function from adhoc
Entrypoint numinwords
Input DOUBLE floatingpoint
SMALLINT number of floatingpoint-digits (no rounding)
CSTRING(2) language identifier for the output
Output CSTRING(32) floatingpoint in words in chosen language
Language identifier: de = German, uk = English, fr = French, es = Spanish, it =Italian, es = Spanish, pt = Portuguese,
nl = Dutch, no = Norwegian, Bokmål, se = Swedish, dk = Danish, fi = Finnish, hu = Hungarian, ie = Irish(Gaelic),
ee = Estonian, is = Icelandic, al = Albanian, va = Classical Latin, v1 = Ecclesiastical Latin, c1 = Catalan, s1 = Scots,
s2 = Scottish Gaelic, w1 = Welsh, b1 = Breton, b2 = Basque, n1 = Norwegian, Nynorsk, za = Afrikaans, fo = Faroese,
lu = Luxembourgish, w2 = Wallon
TestSQL
SELECT '***eins-vier-fünf***' AS ISCORRECT, F_NUMINWORDS(145, 0, 'de') FROM RDB$DATABASE;
SELECT '***eins-vier-fünf-Komma-drei-zwei***' AS ISCORRECT, F_NUMINWORDS(145.32, 2, 'de') FROM RDB$DATABASE;
SELECT '***eins-vier-fünf-Komma-drei-zwei-null-null***' AS ISCORRECT, F_NUMINWORDS(145.32, 4, 'de') FROM RDB$DATABASE;
SELECT '***one-four-five-point-three-two***' AS ISCORRECT, F_NUMINWORDS(145.32, 2, 'uk') FROM RDB$DATABASE;
SELECT '***un-quatre-cinq-virgule-trois-deux***' AS ISCORRECT, F_NUMINWORDS(145.32, 2, 'fr') FROM RDB$DATABASE;
SELECT '***uno-cuatro-cinco-coma-tres-dos***' AS ISCORRECT, F_NUMINWORDS(145.32, 2, 'es') FROM RDB$DATABASE;
SELECT '***uno-quattro-cinque-virgola-tre-due***' AS ISCORRECT, F_NUMINWORDS(145.32, 2, 'it') FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_NUMINWORDS(NULL, NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
 
Numeric-functions: Calculate
F_DOUBLEABS
F_ABS
compatibility FreeUDFLib, FreeUDFLibC, FreeUDFLib AvERP
compatibility zu GrUDF
input/output-compatibility to rFunc (ABS)
substitutable with ABS
Entrypoint doubleabs
Input DOUBLE floatingpoint
Output DOUBLE absolute (positiv) value of a  floatingpoint
TestSQL
SELECT 15.678 AS ISCORRECT, F_DOUBLEABS(15.678) FROM RDB$DATABASE;
SELECT 15.678 AS ISCORRECT, F_DOUBLEABS(-15.678) FROM RDB$DATABASE;
SELECT 15.678 AS ISCORRECT, F_ABS(15.678) FROM RDB$DATABASE;
SELECT 15.678 AS ISCORRECT, F_ABS(-15.678) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_ABS(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_INTEGERABS compatibility FreeUDFLibC
substitutable with ABS
Entrypoint integerabs
Input INTEGER integer
Output INTEGER absolute (positiv) value of an integer
TestSQL
SELECT 15 AS ISCORRECT, F_INTEGERABS(15) FROM RDB$DATABASE;
SELECT 15 AS ISCORRECT, F_INTEGERABS(-15) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_INTEGERABS(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_POWER input/output-compatibility to fbudf (POWER)
input/output-compatibility to rFunc ( POWER)
substitutable with POWER
Entrypoint f_power
Input DOUBLE
number to square
DOUBLE exponent
Output DOUBLE suqare number from parameter 1 exponent parameter 2
TestSQL
SELECT 8.0 AS ISCORRECT, F_POWER(2, 3) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_POWER(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_EXP compatibility to GrUDF
input/output-compatibility to rFunc ( EXP)
substitutable with EXP
Entrypoint f_exp
Input DOUBLE
floatingpoint
Output DOUBLE e exponent  floatingpoint
TestSQL
SELECT 7.38905609893065 AS ISCORRECT, F_EXP(2), F_POWER(F_EULER(), 2) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_EXP(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_SQRT input/output-compatibility to udflib, ib_udf
input/output-compatibility to rFunc ( SQRT)
substitutable with SQRT
Entrypoint f_sqrt
Input DOUBLE
floatingpoint
Output DOUBLE squareroot of  floatingpoint
TestSQL
SELECT 3 AS ISCORRECT, F_SQRT(9) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_SQRT(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_FACT
F_FACTORIAL
function from adhoc
compatibility to GrUDF
Entrypoint fact
Input INTEGER integer
Output DOUBLE factorial (the product of all natural numbers from 1 to parameter 1)
TestSQL
SELECT 6.000 AS ISCORRECT, F_FACT(3) FROM RDB$DATABASE;
SELECT 6.000 AS ISCORRECT, F_FACTORIAL(3) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_FACT(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_MODULO compatibility FreeUDFLib, FreeUDFLibC, FreeUDFLib AvERP, GrUDF
input/output-compatibility to rFunc (MOD)
substitutable with MODULO
Entrypoint f_modulo
Input INTEGER
INTEGER
divident (the number, which will divided)
divisor (the number, by which one divides)
Output INTEGER Modulo (Rest of division of two integers) from parameter 1 divided through parameter 2
TestSQL
SELECT 2 AS ISCORRECT, F_MODULO(5, 3) FROM RDB$DATABASE;
SELECT 0 AS ISCORRECT, F_MODULO(6, 3) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_MODULO(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_DIV input/output-compatibility to rFunc (DIV)
Entrypoint f_div
Input INTEGER
INTEGER
divident (the number, which will divided)
divisor (the number, by which one divides)
Output INTEGER integer part from parameter 1 divided through parameter 2
TestSQL
SELECT 1 AS ISCORRECT, F_DIV(5, 3) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_DIV(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_FLOOR input/output-compatibility to ib_udf
input/output-compatibility to rFunc (FLOOR)
substitutable with FLOOR
Entrypoint f_floor
Input DOUBLE
floatingpoint
Output DOUBLE the largest integer less than or equal to input as a floatingpoint
Note differences from F_FLOOR, F_CEILING and F_TRUNCATE
TestSQL
SELECT 3.0 AS ISCORRECT, F_FLOOR(3.85), F_CEILING(3.85),F_TRUNCATE(3.85) FROM RDB$DATABASE;
SELECT -4.0 AS ISCORRECT, F_FLOOR(-3.85), F_CEILING(-3.85),F_TRUNCATE(-3.85) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_FLOOR(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_CEILING input/output-compatibility to ib_udf
input/output-compatibility to rFunc (CEIL)
substitutable with CEILING
Entrypoint f_ceiling
Input DOUBLE
floatingpoint
Output DOUBLE the smallest integer greater than or equal to input as a floatingpoint
Note differences from F_FLOOR, F_CEILING and F_TRUNCATE
TestSQL
look F_FLOOR
SELECT NULL AS ISCORRECT, F_CEILING(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_FRAC input/output-compatibility to ib_udf
Entrypoint f_frac
Input DOUBLE
floatingpoint
Output DOUBLE the digits after the decimal-seperator of a  floatingpoint
TestSQL
SELECT 0.12345 AS ISCORRECT, F_FRAC(15.12345) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_FRAC(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_LN input/output-compatibility to ib_udf
input/output-compatibility to rFunc (LN)
substitutable with LN
Entrypoint f_ln
Input DOUBLE
floatingpoint
Output DOUBLE natural logarithmn (logarithmn to basis e) of the input
TestSQL
SELECT 0.693147180559945 AS ISCORRECT, F_LN(2) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_LN(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_LOG input/output-compatibility to ib_udf
input/output-compatibility to rFunc (LOG)
substitutable with LOG
Entrypoint f_log
Input DOUBLE
floatingpoint
DOUBLE basis for logarithmn
Output DOUBLE logarithmn of floatingpoint with basis of parameter 2
TestSQL
SELECT 0.301029995663981 AS ISCORRECT, F_LOG(2, 10), F_LOG10(2) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_LOG(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_LOG10 input/output-compatibility to ib_udf
input/output-compatibility to rFunc (LOG10)
substitutable with LOG10
Entrypoint f_log10
Input DOUBLE
floatingpoint
Output DOUBLE logarithmus of  floatingpoint with basis 10
TestSQL
SELECT 0.301029995663981 AS ISCORRECT, F_LOG10(2) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_LOG10(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_ISDIVISIBLEBY compatibility FreeUDFLib, FreeUDFLib AvERP
Entrypoint isdivisibleby
Input INTEGER
INTEGER
divident (the number, which will divided)
divisor (the number, by which one divides)
Output INTEGER 1 = is divisibly through, 0 = is not divisibly through
TestSQL
SELECT 1 AS ISCORRECT, F_ISDIVISIBLEBY(15, 3) FROM RDB$DATABASE;
SELECT 0 AS ISCORRECT, F_ISDIVISIBLEBY(15, 4) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_ISDIVISIBLEBY(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_EVEN function from adhoc
Entrypoint evenodd
Input INTEGER integer
Output INTEGER 1 = is even, 0 = is odd
If a floatingpoint is used as input, it will be truncated first to integer and than tested!
TestSQL
SELECT 1 AS ISCORRECT, F_EVEN(2) FROM RDB$DATABASE;
SELECT 0 AS ISCORRECT, F_EVEN(3) FROM RDB$DATABASE;
SELECT 1 AS ISCORRECT, F_EVEN(0) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_EVEN(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_SIGN input/output-compatibility to ib_udf
input/output-compatibility to rFunc (SIGN)
substitutable with SIGN
Entrypoint f_sign
Input DOUBLE
floatingpoint
Output DOUBLE sign of  floatingpoint 1 = positiv, 0 = 0, -1 = negativ
TestSQL
SELECT 1 AS ISCORRECT, F_SIGN(3) FROM RDB$DATABASE;
SELECT -1 AS ISCORRECT, F_SIGN(-3) FROM RDB$DATABASE;
SELECT 0 AS ISCORRECT, F_SIGN(0) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_SIGN(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_PROZENTE compatibility FreeUDFLib AvERP, GrUDF
Entrypoint prozente
Input DOUBLE
DOUBLE
floatingpoint  1
floatingpoint  2
Output DOUBLE who many % of 2nd from 1st
f.e. selling price to purchase price
Test-SQL
SELECT 14.000 AS ISCORRECT, F_PROZENTE(100.00, 14.0) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_PROZENTE(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_Z input/output-compatibility to rFunc (Z)
Entrypoint r_z Output RETURN mechanism BY VALUE
Input DOUBLE
floatingpoint
Output DOUBLE if Input <null> Output 0 otherwise Input
Test-SQL
SELECT 14.000 AS ISCORRECT, F_Z(14.0) FROM RDB$DATABASE;
SELECT 0 AS ISCORRECT, F_Z(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_DZERO input/output-compatibility to rFunc (DZERO)
Entrypoint r_dzero Output RETURN mechanism BY VALUE
Input DOUBLE
DOUBLE
DOUBLE
divident (the number, which will divided)
divisor (the number, by which one divides)
value of divisor if divisor = 0
Output DOUBLE if divisor = 0 output parameter 3 otherwise division paramter 1 / parameter 2
Test-SQL
SELECT 14.000 AS ISCORRECT, F_DZERO(15.5, 0.0, 14.0) FROM RDB$DATABASE;
nach oben • go top •
 
Numeric-functions: Compare
F_MAXNUM
 
F_MAX
function from adhoc
input/output-compatibility to rFunc (MAXNUM)
compatibility to GrUDF
substitutable with MAX
Entrypoint maxnum
Input DOUBLE
DOUBLE
floatingpoint 1
floatingpoint 2
Output DOUBLE the max. of the two  floatingpoins
TestSQL
SELECT 15.346 AS ISCORRECT, F_MAXNUM(15.345, 15.346) FROM RDB$DATABASE;
SELECT 15.346 AS ISCORRECT, F_MAX(15.345, 15.346) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_MAX(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_MINNUM
 
F_MIN
function from adhoc
input/output-compatibility to rFunc (MINNUM)
compatibility GrUDF
substitutable with MIN
Entrypoint minnum
Input DOUBLE
DOUBLE
floatingpoint 1
floatingpoint 2
Output DOUBLE the min. of the two  floatingpoins
TestSQL
SELECT 15.345 AS ISCORRECT, F_MINNUM(15.345, 15.346) FROM RDB$DATABASE;
SELECT 15.345 AS ISCORRECT, F_MIN(15.345, 15.346) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_MIN(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_EQUALINTEGER compatibility FreeUDFLib AvERP, GrUDF
input/output-compatibility to rFunc (IEQUAL)
Entrypoint equalinteger
Input INTEGER
INTEGER
integer 1
integer 2
Output INTEGER 1 =is equal, 0 = is not equal
If a floatingpoint is used as input, it will be truncated first to integer and than tested!
TestSQL
SELECT 1 AS ISCORRECT, F_EQUALINTEGER(14, 14) FROM RDB$DATABASE;
SELECT 0 AS ISCORRECT, F_EQUALINTEGER(14, 15) FROM RDB$DATABASE;
SELECT 1 AS ISCORRECT, F_EQUALINTEGER(14, 14.49) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_EQUALINTEGER(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_EQUALFLOAT compatibility zu FreeUDFLib AvERP, GrUDF
input/output-compatibility to rFunc (DEQUAL)
Entrypoint equalfloat
Input DOUBLE
DOUBLE
floatingpoint 1
floatingpoint 2
Output DOUBLE 1 =is equal, 0 = is not equal
TestSQL
SELECT 1 AS ISCORRECT, F_EQUALFLOAT(14.00, 14.0) FROM RDB$DATABASE;
SELECT 0 AS ISCORRECT, F_EQUALFLOAT(14.00, 14.01) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_EQUALFLOAT(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
 
Numeric-functions: Binary functions
F_BIN_AND input/output-compatibility to ib_udf
input/output-compatibility to rFunc (BINAND)
substitutable with BIN_AND
Entrypoint f_bin_and
Input INTEGER
INTEGER
integer 1
integer 2
Output INTEGER binary AND of the two integers
TestSQL
SELECT 1 AS ISCORRECT, F_BIN_AND(3, 5) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_BIN_AND(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_BIN_OR input/output-compatibility to ib_udf
input/output-compatibility to rFunc (BINOR)
substitutable with BIN_OR
Entrypoint f_bin_or
Input INTEGER
INTEGER
integer 1
integer 2
Output INTEGER binary OR  of the two integers
TestSQL
SELECT 7 AS ISCORRECT, F_BIN_OR(3, 5) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_BIN_OR(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_BIN_XOR input/output-compatibility to ib_udf
input/output-compatibility to rFunc (BINXOR)
substitutable with BIN_XOR
Entrypoint f_bin_xor
Input INTEGER
INTEGER
integer 1
integer 2
Output INTEGER binary exclusive OR of the two integers
TestSQL
SELECT 6 AS ISCORRECT, F_BIN_XOR(3, 5) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_BIN_XOR(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_BIN_NOT input/output-compatibility to ib_udf
input/output-compatibility to rFunc (BINNOT)
Entrypoint f_bin_not
Input INTEGER integer 
Output INTEGER binary NOT of integer
TestSQL
SELECT -4 AS ISCORRECT, F_BIN_NOT(3) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_BIN_NOT(NULL) FROM RDB$DATABASE;
nach oben • go top •
F_BIN_SHL input/output-compatibility to ib_udf, GrUDF
substitutable with BIN_SHL
Entrypoint f_bin_shl
Input INTEGER
INTEGER
integer 1
integer 2
Output INTEGER binary SHIFT left
TestSQL
SELECT 96 AS ISCORRECT, F_BIN_SHL(3, 5) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_BIN_SHL(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_BIN_SHR input/output-compatibility to ib_udf, GrUDF
substitutable with BIN_SHR
Entrypoint f_bin_shr
Input INTEGER
INTEGER
integer 1
integer 2
Output INTEGER binary SHIFT right
TestSQL
SELECT 0 AS ISCORRECT, F_BIN_SHR(3, 5) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_BIN_SHR(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_BIN_GET input/output-compatibility to rFunc (GETBIT)
Entrypoint r_getbit
Input INTEGER
INTEGER
integer
No. of Bit looked for
Output INTEGER parameter 2 Bit of integer
TestSQL
SELECT 0 AS ISCORRECT, F_BIN_GET(3, 5) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_BIN_SHR(NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
F_BIN_SET input/output-compatibility to rFunc (SETBIT)
Entrypoint r_setbit
Input INTEGER
INTEGER
INTEGER
integer
No. of  Bit to replace
Bit to set
Output INTEGER integer returned when Bit of parmeter 2 was replaced with Bit of parameter 3
TestSQL
SELECT 1 AS ISCORRECT, F_BIN_GET(F_BIN_SET(3, 5, 1), 5) FROM RDB$DATABASE;
SELECT 35 AS ISCORRECT, F_BIN_SET(3, 5, 1) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_BIN_SHR(NULL, NULL, NULL) FROM RDB$DATABASE;
nach oben • go top •
 
Numeric-functions: Trigonometry
input/output-compatibility to ib_udf
input/output-compatibility to rFunc
Input ever DOUBLE ... in radian
Output ever DOUBLE ... in radian
F_SIN counts Sinus
substitutable with SIN
F_COS counts Cosinus
substitutable with COS
F_TAN counts Tangens
substitutable with TAN
F_COT counts Cotangens
substitutable with COT
F_ASIN counts ArcSinus
substitutable with ASIN
F_ACOS counts ArcCosinus
substitutable with ACOS
F_ATAN counts ArcTangens
substitutable with ATAN
F_ACOT counts ArcCotangens
function from adhoc
Input ever DOUBLE ... in degree
Output ever DOUBLE ... in degree
F_SIND
F_COSD
F_TAND
F_COTD
F_ARCSIND
F_ARCCOSD
F_ARCTAND
F_ARCCOTD
counts Sinus
counts Cosinus
counts Tangens
counts Cotangens
counts ArcSinus
counts ArcCosinus
counts ArcTangens
counts ArcCotangens
input/output-compatibility to ib_udf
input/output-compatibility to rFunc
Input ever DOUBLE
Output ever DOUBLE
F_SINH counts SinusHyperbolicus
substitutable with SINH
F_COSH counts CosinusHyperbolicus
substitutable with COSH
F_TANH counts TangensHyperbolicus
substitutable with TANH
F_COTH counts CotangensHyperbolicus
function from adhoc
F_ARSINH
F_ARCOSH
F_ARTANH
F_ARCOTH
counts AreaSinusHyperbolicus
counts AreaCosinusHyperbolicus
counts AreaTangensHyperbolicus
counts AreaCotangensHyperbolicus
TestSQL
SELECT 1 AS ISCORRECT, F_SIN(1.5707963267949), F_SIN(F_DEGTORAD(90)), F_SIND(90) FROM RDB$DATABASE;
SELECT NULL AS ISCORRECT, F_SIN(NULL) FROM RDB$DATABASE;
vorige Seite • previous page • passée sitenach oben • go top • vers le hautnächste Seite • next page • prochain site