- Addition, Subtraction, Multiplication, and Division
- Remainder (modulo) %
- Power **
- Absolute Value ||
- Increment ++ and Decrement --
- Arithmetic Shift Left << and Right >>
- Logical Shift Right >>>
- bitand, bitor, bitxor, bit negation (~)
All arithmetical calculations on integral types wrap around when their bounds are exceeded.
Values of type float or double do not wrap around. Instead, inf
is produced for "positive infinity" and -inf
for "negative infinity".
Dividing integral values by zero throws an exception. Whereas dividing values of type float or double produce inf
.
Addition, Subtraction, Multiplication, and Division
a = b + c; a = b - c; a = b*c; a = b/c;
Remainder (modulo) %
a = b%c;
Power **
a = b**c;
Absolute Value ||
a = |b|;
Increment ++ and Decrement --
a = b++; a = ++b; a = b--; a = --b;
Arithmetic Shift Left << and Right >>
int a = b << c; int a = b >> c;
Logical Shift Right >>>
int a = b >>> c;
bitand, bitor, bitxor, bit negation (~)
int a = b bitand c; int a = b bitor c; int a = b bitxor c; int a = ~b;
Comments
0 comments
Please sign in to leave a comment.