The mathLib.decimals() system function returns the number of decimal places with which a numeric variable was defined.
mathLib.decimals(numericVariable DECIMAL in)
returns (result INT)
myVar BIN(9,4);
result = mathLib.decimals(myVar); // result = 4