2.1.3 Numeric Operators
This the list of numeric operators in Haxe, grouped by descending priority.
Arithmetic
Operator | Operation | Operand 1 | Operand 2 | Return |
---|---|---|---|---|
++ |
increment | Int |
N/A | Int |
Float |
N/A | Float |
||
-- |
decrement | Int |
N/A | Int |
Float |
N/A | Float |
||
+ |
addition | Float |
Float |
Float |
Float |
Int |
Float |
||
Int |
Float |
Float |
||
Int |
Int |
Int |
||
- |
subtraction | Float |
Float |
Float |
Float |
Int |
Float |
||
Int |
Float |
Float |
||
Int |
Int |
Int |
||
* |
multiplication | Float |
Float |
Float |
Float |
Int |
Float |
||
Int |
Float |
Float |
||
Int |
Int |
Int |
||
/ |
division | Float |
Float |
Float |
Float |
Int |
Float |
||
Int |
Float |
Float |
||
Int |
Int |
Float |
||
% |
modulo | Float |
Float |
Float |
Float |
Int |
Float |
||
Int |
Float |
Float |
||
Int |
Int |
Int |
Comparison
Operator | Operation | Operand 1 | Operand 2 | Return |
---|---|---|---|---|
== |
equal | Float/Int |
Float/Int |
Bool |
!= |
not equal | Float/Int |
Float/Int |
Bool |
< |
less than | Float/Int |
Float/Int |
Bool |
<= |
less than or equal | Float/Int |
Float/Int |
Bool |
> |
greater than | Float/Int |
Float/Int |
Bool |
>= |
great than or equal | Float/Int |
Float/Int |
Bool |
Bitwise
Operator | Operation | Operand 1 | Operand 2 | Return |
---|---|---|---|---|
~ |
bitwise negation | Int |
N/A | Int |
& |
bitwise and | Int |
Int |
Int |
| |
bitwise or | Int |
Int |
Int |
^ |
bitwise xor | Int |
Int |
Int |
<< |
shift left | Int |
Int |
Int |
>> |
shift right | Int |
Int |
Int |
>>> |
unsigned shift right | Int |
Int |
Int |
Equality
For enums:
- Enum without parameters Are always represent the same value, so
MyEnum.A == MyEnum.A
. - Enum with parameters Can be compared with
a.equals(b)
(which is a short forType.enumEquals()
).
Dynamic: Comparison involving at least one Dynamic value is unspecifed and platform-specific.