Arithmetic Operators
Arithmetic operators are used in equations.
=
Assignment operator
+
Add

Subtract
*
Multiply
/
Divide
%
Modulo division.
Returns the remainder of a a division.
++
Increments the current value by 1
Preincrement (++i), Postincrement (i++)

Decrements the current value by 1
Predecrement (i), Postdecrement (i)
+=
=
+=
/=
Compound addition (x += y is same as x = x + y)
Compound subtraction (x = y is same as x = x  y)
Compound multiplication (x *= y is same as x = x * y)
Compound division (x /= y is same as x = x / y)
Data Types
short
Whole numbers, no decimal points, 16bit signed
Max value is 2^{15}  1 (32,767)
Min value is 2^{15} (32,768)
int
Whole numbers, no decimal points. 32bit signed
Trying to assign a double to an int variable type will always result in an int. The decimals are truncated not rounded.
Max value: 2^{31} – 1 (2,147,483,647)
Min value: 2^{31} (2,147,483,648)
Default value is 0
long
Whole numbers, no decimal points. Similar to int. Long variables are extended size variables for number storage and store 32 bits (4 bytes)…which means the min and max values are the same as for a short.
Max value: 2^{63} – 1 (9,223,372,036,854,775,807)
Min value: 2^{63} (9,223,372,036,854,775,808)
Default value is 0L
If doing math with integers, at least one of the numbers must be followed by an L, forcing it to be a long.
e.g.
long speedOfLight = 186000L;
float
Data type for storing floatingpoint numbers (a number with decimal points).
Max value: 3.4028235 x 10^{38}
Min value: 3.4028235 x 10^{38}
Stored as 32 bits (4 bytes) of information.
Floats have only 6 – 7 decimal digits of precision. That is, the total number of digits…not the number to the right of the decimal point.
Default value is 0.0
Floating point numbers are not exact and may yield strange results.
e.g.
6.0 / 3.0 may not equal 2.0
Note:
Floating point math is much slower than integer math in performing calculations, so should be avoided if, for example, a loop has to run at top speed for a critical timing function.
double
Double precision floating point number. On the Uno and other ATMEGA based boards, this occupies 4 bytes…meaning that a double is exactly the same as a float, with no gain in precision.
On Arduino Due, double is 8byte (64bit) precision and is more precise than float.
Default value is 0.0
Double data type is generally used as the default data type for decimal values
char
Single 16bit Unicode character
Char data type is used to store any character
boolean
Boolean data type represents 1 bit of information
Only two possible choses: TRUE, FALSE
Default value is FALSE (0)