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

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
ROUND
Round a floating-point constant to the nearest integer.
((CON ┆ VAR ┆ OBJ ┆ PUB ┆ PRI ┆ DAT))
Returns: Nearest integer to original floating-point constant value.
Explanation
ROUND
expressions.
floating-point constant expression. Fractional values of ½ (.5) or higher are rounded up to the
nearest whole number while lower fractions are rounded down.
Using ROUND
ROUND
Note that this is for compile-time constant expressions only, not run-time variable
expressions. For example:
The above code creates two floating-point constants,
0.4999, respectively. The next three constants,
that are based on
Rnd3
About Floating-Point Constants
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
ROUND
CON
= 9.
OneHalf = 0.5
Smaller = 0.4999
Rnd1
Rnd2
Rnd3
can be used to round floating-point constants up or down to the nearest integer value.
is one of three directives (
FloatConstant
integer.
( FloatConstant )
ROUND
= round(OneHalf)
= round(Smaller)
= round(Smaller * 10.0) + 4
OneHalf
returns an integer constant that is the closest integer value to the given
is the floating-point constant expression to be rounded to the nearest
and
Smaller
FLOAT
,
using the
ROUND
4: Spin Language Reference –
and
Rnd1
ROUND
TRUNC
OneHalf
,
Rnd2
directive.
) used for floating-point constant
and
Propeller Manual v1.0 · Page 303
and
Rnd3
Smaller
Rnd1
, are integer constants
= 1,
, equal to 0.5 and
Rnd2
= 0, and

Related parts for 122-32000