Propeller Manual

Table Of Contents
2: Spin Language Reference – Operators
Operators
The Propeller chip features a powerful set of math and logic operators. A subset of these
operators is supported by the Propeller Assembly language; however, since the Spin language
has a use for every form of operator supported by the Propeller, this section describes every
operator in detail. Please see the Operators section on page 325 for a list of operators
available in Propeller Assembly.
Expression Workspace
The Propeller is a 32-bit device and, unless otherwise noted, expressions are always evaluated
using 32-bit, signed integer math. This includes intermediate results as well. If any
intermediate result overflows a 32-bit signed integer (above 2,147,483,647 or below
-2,147,483,648), the final result of the expression will not be as expected. A workspace of 32
bits provides lots of room for intermediate results but it is still wise to keep overflow
possibilities in mind.
If mathematic truncation is an issue, or if an expression requires real numbers rather than
integers, floating-point support can help. The compiler supports 32-bit floating-point values
and constant expressions with many of the same math operators as it does for integer constant
expressions. Note that this is for constant expressions only, not run time variable
expressions. For floating-point run-time expressions, the Propeller chip provides support
through the FloatMath object supplied with the software installation. See Constant
Assignment ‘=’, page 148;
FLOAT, page 108; ROUND, page 198; and TRUNC, page 209, as well
as the FloatMath and FloatString objects for more information
Operator Attributes
The operators have the following important attributes, each of which is shown in the
following two tables and further explained afterwards:
Unary / Binary
Normal / Assignment
Constant and/or Variable Expression
Level of Precedence
Propeller Manual v1.1 · Page 143