Elmo HARmonica, HARSFEN0602 software manual Operator details, Xor

Models: HARmonica HARSFEN0602

1 220
Download 220 pages 51.63 Kb
Page 22
Image 22

HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARY

DRAFT

 

 

 

 

 

 

 

 

+

Add two operands.

 

 

9

 

 

-

Subtract the right operand from the left one.

 

 

9

 

 

*

Multiply two operands.

 

 

10

 

 

/

Divide the left operand by the right one.

 

 

10

 

 

%

Remainder after division two integers

 

 

10

 

 

^

XOR

 

 

1

 

 

~

Bitwise NOT of an operand.

 

 

11

 

 

&

Bitwise AND between two operands.

 

 

5

 

 

Bitwise OR between two operands.

 

 

4

 

 

<<

Bitwise Shift left

 

 

8

 

 

>>

Bitwise Shift right

 

 

8

 

 

==

Logical equality

 

 

6

 

 

!=

Logic not equal

 

 

6

 

 

<

Logic smaller than

 

 

7

 

 

<=

Logic smaller or equal

 

 

7

 

 

>

Logic greater than

 

 

7

 

 

>=

Logic greater or equal

 

 

7

 

 

&&

Logical AND

 

 

3

 

 

Logical OR

 

 

2

 

 

!

Logical negation

 

 

11

 

 

-

Unary minus

 

 

11

 

 

=

Assignment

 

 

 

 

 

()

Parentheses, for expression nesting and function calls

 

 

 

 

[]

Square parenthesis, for array indices and multiple value function

 

 

 

 

 

returns

 

 

 

 

 

 

Table 4-1 – Mathematical and Logical Operators

 

 

4.2.3General rules for operators

4.2.3.1Promotion to float and truncation to integer

Most the arithmetic operators work on both integers and floats. An arithmetic operation between integers will yield integers, an operation between floating point numbers, or between an integer and a floating-point number, will yield a floating-point result. For example, all the expressions below are legitimate:

1+2 (The result is 3, integer)

1+0x10 (The result is 17, integer) Note that 0x10 is treated as a standard integer.

1+2.0 (The result is 3.0, float) 2.1+3.4 (The result is 5.5, float)

The operation of division between two integers may yield a floating-point result in a case of division with remainder. For example:

8/2 (The result is 4, integer) 9/2 (The result is 4.5, float)

If a result of multiplication between two integers overflows integer range [-2.1475e+009,+2.1475e+009], this result will be converted into floating point, but won’t be truncated. For example:

100000 * 100000 (The result is 10000000000, float)

Bit operators require an integer input. Floating-point inputs to bit operators are truncated to integers.

7.9& 3.4 is equivalent to 7 & 3, since before applying the operator & (Bitwise AND) the floating point number 7.9 is truncated to the integer 7, and 3.4 is truncated to the integer 3..

4.2.4Operator details

The following paragraphs describe the operators in detail.

20

Page 22
Image 22
Elmo HARmonica, HARSFEN0602 software manual Operator details, Xor