The operators *
, /
, and %
are called the multiplicative operators. They have the
same precedence and are syntactically left-associative (they group left-to-right).
MultiplicativeExpression:
UnaryExpression
MultiplicativeExpression*
UnaryExpression
MultiplicativeExpression/
UnaryExpression
MultiplicativeExpression%
UnaryExpression
The type of each of the operands of a multiplicative operator must be a primitive numeric type, or a compile-time error occurs. Binary numeric promotion is performed on the operands (§5.6.2). The type of a multiplicative expression is the promoted type of its operands. If this promoted type is int
or long
, then integer arithmetic is performed; if this promoted type is float
or double
, then floating-point arithmetic is performed.