meta data for this page
  •  

F_WEIGHTCROSSSUM

function from adhoc

Entrypoint weightcrosssum compatible with UTF-8


Inputs/Outputs

   Input      INTEGER     natural number
   Output     INTEGER     weighted cross sum from input

Syntax

   The weighted cross sum is to add all multiplied digits of the number with its place value, starting right.
   i.e. 12345: 5*1 + 4*2 + 3*3 + 2*4 + 1*5 = 35
   Test-SQL
   SELECT 35 AS ISCORRECT, F_WEIGHTCROSSSUM(12345) FROM RDB$DATABASE;
   SELECT NULL AS ISCORRECT, F_WEIGHTCROSSSUM(NULL) FROM RDB$DATABASE;