EXPRESSIONS
Multiplication Operator
*
15.16.1
15.16 Multiplicative Operators
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 primi
tive 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.
15.16.1 Multiplication Operator
*
Entia non sunt multiplicanda praeter necessitatem.
William of Occam (c. 1320)
The binary
*
operator performs multiplication, producing the product of its oper
ands. Multiplication is a commutative operation if the operand expressions have
no side effects. While integer multiplication is associative when the operands are
all of the same type, floating point multiplication is not associative.
If an integer multiplication overflows, then the result is the low order bits of
the mathematical product as represented in some sufficiently large two's comple
ment format. As a result, if overflow occurs, then the sign of the result may not be
the same as the sign of the mathematical product of the two operand values.
The result of a floating point multiplication is governed by the rules of IEEE
754 arithmetic:
If either operand is NaN, the result is NaN.
If the result is not NaN, the sign of the result is positive if both operands have
the same sign, and negative if the operands have different signs.
Multiplication of an infinity by a zero results in NaN.
Multiplication of an infinity by a finite value results in a signed infinity. The
sign is determined by the rule stated above.
351
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved