decimalMultiply#

swordfish.function.decimalMultiply()#

The function multiplies Decimals. Compared with the mul function or operator *, the function can set the decimal places of the result with scale.

Note

In the following situations, the specified scale does not take effect and the function is equivalent to operator *.

  • Only one argument is of DECIMAL type (with scale S), and the specified scale is not equal to S.

  • X and Y are both of DECIMAL type (with scale S1 and S2, respectively), and the specified scale is smaller than min(S1, S2) or greater than (S1+S2).

  • One argument is a floating-point number.

For the first two situations, the function return a DECIMAL type result, and for the third situation it returns a result of DOUBLE type.

Parameters:
  • X (Constant) – A scalar or vector, and at least one argument is of DECIMAL type.

  • Y (Constant) – A scalar or vector, and at least one argument is of DECIMAL type.

  • scale (Constant) – A non-negative integer indicating the decimal places to be retained in the result.