122-32000 Parallax Inc, 122-32000 Datasheet - Page 255

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
4: Spin Language Reference – Operators
expression must be a floating-point value; you cannot mix integer and floating-point values
like Ratio = 2 / 5.0. You can, however, use the
declaration to convert an integer value
FLOAT
to a floating-point value, such as
.
Ratio = FLOAT(2) / 5.0
The Propeller compiler handles floating-point constants as a single-precision real number as
described by the IEEE-754 standard. Single-precision real numbers are stored in 32 bits, with
a 1-bit sign, an 8-bit exponent, and a 23-bit mantissa (the fractional part). This provides
approximately 7.2 significant decimal digits.
For run-time floating-point operations, the FloatMath and FloatString objects provide math
functions compatible with single-precision numbers.
See
, page 216;
, page 303;
, page 314, as well as the FloatMath and
FLOAT
ROUND
TRUNC
FloatString objects for more information.
Variable Assignment ‘
:=
The Variable Assignment operator is used within methods (
and
blocks) to assign a
PUB
PRI
value to a variable. For example,
Temp := 21
Triple := Temp * 3
At run time this code would set the
variable equal to 21 and set
to 21 * 3, which
Temp
Triple
is 63.
As with other assignment operators, the Variable Assignment operator can be used within
expressions to assign intermediate results, such as:
Triple := 1 + (Temp := 21) * 3
This example first sets
to 21, then multiplies
by 3 and adds 1, finally assigning the
Temp
Temp
result, 64, to
.
Triple
Add ‘
’, ‘
+
+=
The Add operator adds two values together. Add can be used in both variable and constant
expressions. Example:
X := Y + 5
Add has an assignment form,
, that uses the variable to its left as both the first operand and
+=
the result destination.
For example,
Propeller Manual v1.0 · Page 255

Related parts for 122-32000