Propeller Manual

Table Of Contents
Operators – Spin Language Reference
Square Root ‘^^
The Square Root operator returns the square root of a value. Square Root can be used in both
variable and constant expressions. When used with variable expressions or integer constant
expressions, Square Root returns the 32-bit truncated integer result. When used with
floating-point constant expressions, Square Root returns the 32-bit single-precision floating-
point result. Example:
X := ^^Y
Square Root becomes an assignment operator when it is the sole operator to the left of a
variable on a line by itself. For example:
^^Y
This would store the square root of the value of Y back into Y.
Absolute Value ‘
||
The Absolute Value operator, also called Absolute, returns the absolute value (the positive
form) of a number. Absolute Value can be used in both variable and constant expressions.
When used with variable expressions or integer constant expressions, Absolute Value returns
the 32-bit integer result. When used with floating-point constant expressions, Absolute Value
returns the 32-bit single-precision floating-point result. Example:
X := ||Y
If Y is -15, the absolute value, 15, would be stored into X.
Absolute Value becomes an assignment operator when it is the sole operator to the left of a
variable on a line by itself. For example:
||Y
This would store the absolute value of Y back into Y.
Sign-Extend 7 or Post-Clear ‘
~
This operator is a special, immediate operator that has a dual purpose depending on which
side of the variable it appears on. It can only be used in run-time variable expressions. The
Sign-Extend 7 form of the operator appears to the left of a variable and the Post-Clear form
appears to the right of a variable.
The following is an example of the Sign-Extend 7 operator form:
Page 156 · Propeller Manual v1.1