# Priority 4 operators

 * x * y Multiplication operator / x / y Division operator % x % y Modulo operator

They are binary arithmetic operators and have left-associativity.

The operand must be one of the int, long, or real. These can be mixed in operands.

Multiplication operator

Division operator

Modulo operator

## Multiplication operator

This is an operator for multiplying operands.

The result class will be the one with the widest range of operands: real > long > int.

real r0 = 123.5 * 10.0; // Left is real, right is real, result is real.

real r1 = 123.5 * 10; // Left is real, right is int, result is real.

real r2 = 123.5 * 10L; // Left is real, right is long, result is real.

long l0 = 123L * 10L; // Left is long, right is long, result is long.

long l1 = 123L * 10; // Left is long, right is int, result is long.

int i0 = 123 * 10; // Left is int, right is int, result is int.

An exception is thrown if the result exceeds the range of class values.

int max = 0.Max;

int result = max * 2; // Over flow. Exception will be thrown.

If operands return the proxy class, the entity of the proxy is automatically used. The result is the same as calling the Entity getter of the proxy class.

int i = 10;

real r = 10.5;

proxy pro = new proxy(i);

proxy pro2 = new proxy(r);

real r2 = pro2 * pro; // r2 is 105.

## Division operator

This is an operator for dividing operands.

The result class will be the one with the widest range of operands: real > long > int.

real r0 = 123.5 / 10.0; // Left is real, right is real, result is real.

real r1 = 123.5 / 10; // Left is real, right is int, result is real.

real r2 = 123.5 / 10L; // Left is real, right is long, result is real.

long l0 = 123L / 10L; // Left is long, right is long, result is long.

long l1 = 123L / 10; // Left is long, right is int, result is long.

int i0 = 123 / 10; // Left is int, right is int, result is int.

If the result class is int or long, the remainder is truncated.

If division by zero, an exception is thrown.

If the value of the result exceeds the range of the class, an exception is thrown.

If operands return the proxy class, the entity of the proxy is automatically used. The result is the same as calling the Entity getter of the proxy class.

int i = 10;

real r = 10.5;

proxy pro = new proxy(i);

proxy pro2 = new proxy(r);

real r2 = pro2 / pro; // r2 is 1.

## Modulo operator

This is an operator that divides operands to find the remainder.

The result class will be the one with the widest range of operands: real > long > int.

real r0 = 123.5 % 10.0; // Left is real, right is real, result is real.

real r1 = 123.5 % 10; // Left is real, right is int, result is real.

real r2 = 123.5 % 10L; // Left is real, right is long, result is real.

long l0 = 123L % 10L; // Left is long, right is long, result is long.

long l1 = 123L % 10; // Left is long, right is int, result is long.

int i0 = 123 % 10; // Left is int, right is int, result is int.

If division by zero, an exception is thrown.

If the value of the result exceeds the range of the class, an exception is thrown.

If operands return the proxy class, the entity of the proxy is automatically used. The result is the same as calling the Entity getter of the proxy class.

int i = 10;

real r = 10.5;

proxy pro = new proxy(i);

proxy pro2 = new proxy(r);

real r2 = pro2 % pro; // r2 is 0.5.