meta data for this page
  •  

F_CROSSDIFF

function from adhoc

Entrypoint crossdiff compatible with UTF-8


Inputs/Outputs

   Input      INTEGER     natural number
   Output     INTEGER     cross diff from input

Syntax

   The alternate cross sum (also called cross diff) is to alternate addition and subtraction the digits of a number starting right.
   i.e. 12345:  5-4+3-2+1 = 3
   Test-SQL
   SELECT 3 AS ISCORRECT, F_CROSSDIFF(12345) FROM RDB$DATABASE;
   SELECT NULL AS ISCORRECT, F_CROSSDIFF(NULL) FROM RDB$DATABASE;