Contents | Prev | Next | Index


Arithmetic Operators

+ sum
- difference
* product
/ real quotient
DIV integer quotient
MOD modulus

The operators +, -, *, and / apply to operands of numeric types The result type is the one that includes the types of the other operands, except for division (/), where the result is the smallest real type that includes both operand types. When used as unary operators, - denotes sign inversion and + denotes the identity operation. The operators DIV and MOD apply to integer operands only. They are related by the following formulas, defined for any x and positive divisor y:

  x = (x DIV y) * y + (x MOD y)
  0 <= (x MOD y) < y

Examples:

 
x y x DIV y x MOD y
5 3 1 2
-5 3 -2 1


Contents | Prev | Next | Index

Canterbury Oberon-2 for JVM  (Last documentation update Jun 2, 2000)
Copyright © 1998 Mill Hill & Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to mhc@webcom.com