RAD Studio
ContentsIndex
PreviousUpNext
Multiplicative Operators

Syntax

multiplicative-expr * cast-expr
multiplicative-expr / cast-expr
multiplicative-expr % cast-expr

Remarks 

There are three multiplicative operators:

  • * (multiplication)
  • / (division)
  • % (modulus or remainder)
The usual arithmetic conversions are made on the operands. 

(op1 * op2) Product of the two operands 

(op1 / op2) Quotient of (op1 divided by op2) 

(op1 % op2) Remainder of (op1 divided by op2) 

For / and %, op2 must be nonzero op2 = 0 results in an error. (You can't divide by zero.) 

When op1 and op2 are integers and the quotient is not an integer:

  • 1. If op1 and op2 have the same sign, op1 / op2 is the largest integer less than the true quotient, and op1 % op2 has the sign of op1.
  • 2. If op1 and op2 have opposite signs, op1 / op2 is the smallest integer greater than the true quotient, and op1 % op2 has the sign of op1.
Note: Rounding is always toward zero.
* is context sensitive and can be used as the pointer reference operator.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!