Numeric data types – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 103

Advertising
background image

Chapter
Data Types

8

8 -3

Two numeric data types exist:

integer
floating-point

You can enter and display these numeric data types in four formats:

integer

(ex.

129

)

decimal

(ex.

34.98

)

hexadecimal

(ex.

0A6EH

)

exponential

(ex.

1.23456E+3

)

The BASIC module interprets all numbers as floating point numbers
except when performing logical operations. When performing logical
operations, the BASIC module converts floating point numbers to integers,
performs the operation, then converts the result back to floating point.

Integer Numbers

The BASIC module operates on unsigned 16-bit integers, ranging from 0
to 65535 or 0FFFFH. You can enter all integers in either decimal or
hexadecimal format. You indicate a hexadecimal number by placing the
character H after the number (ex.170H). If the hexadecimal number begins
with A - F, then you must precede it by a zero. For example, you must
enter A567H as 0A567H. When an operator, such as .AND. (page 9 -7)
requires an integer, the BASIC module truncates the fraction portion of the
number so it fits the integer format. For example, both 6.3 and 6.8 when
interpreted as an integer would equal 6.

Floating-Point Numbers

The BASIC module stores all numbers as floating-point numbers.
Floating-point numbers are numbers in which the decimal point floats
depending on the significant digits of a specific number. The BASIC
module accounts for the location of the decimal point. This allows the
BASIC module to store only the significant digits of a value, thus saving
memory space.

You can represent

±

1E

-127

to

±

.99999999

+127

in the BASIC module.

There are eight significant digits. Numbers are internally rounded to fit
this precision.

Numeric Data Types

Advertising