MUL

Returns the product of two or more inputs.

Signature

     ┌─────────┐
IN1 ─┤         │
IN2 ─┤   MUL   ├─ OUT
IN3 ─┤         │
     └─────────┘
FUNCTION MUL : ANY_NUM
  VAR_INPUT
    IN1 : ANY_NUM;
    IN2 : ANY_NUM;
    (* ... additional inputs ... *)
  END_VAR
END_FUNCTION

The return type matches the input type. MUL accepts SINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT, REAL, LREAL. All inputs must share the same type.

Inputs

Name

Type

Description

IN1

ANY_NUM

The first multiplicand.

IN2

ANY_NUM

The second multiplicand.

Outputs

Name

Type

Description

Return value

ANY_NUM

The product of IN1 and IN2. Same type as the inputs.

Description

Returns IN1 multiplied by IN2. MUL(a, b) is the functional form of the * operator: a * b. Both forms are equivalent.

For integer types, overflow behavior wraps around (modular arithmetic).

Example

result := MUL(6, 7);   (* result = 42 *)
result := 6 * 7;       (* result = 42, operator form *)

See Also

  • ADD — addition

  • DIV — division

  • MOD — modulo

References