![background image](http://html1.mh-extra.com/html/omron/c500-asc04/c500-asc04_operation-manual_743033035.webp)
24
! Single-precision real: Uses 4 bytes per variable.
# Double-precision real: Uses 8 bytes per variable.
$ Character: Uses a maximum of 255 characters.
There is a second way to declare variable types. The BASIC statements DE-
FINT, DEFSTR, DEFSNG, and DEFDBL may be used to declare the types for
certain variable names.
Variable Array
An array is a group of values of the same TYPE that is stored and referenced as a
unit by the same variable name. Each element in an array has a unique position
and is referenced by the name of the array subscripted with an integer or integer
expression.
There can be many dimensions to an array. The most common types are one,
two, and three dimensional arrays. An array has one subscript for each dimen-
sion in the array.
For example, T(4) would reference the fourth element in the one-dimensional
array T. R(2,3) would reference the value located in the second row and third
column of the two-dimensional array R.
The maximum number of dimensions of an array is 255. The maximum number
of elements per dimension is 32767. The array size and number of dimensions
must be declared with the DIM statement. The subscript value zero is the posi-
tion of the first element in an array. All elements of an array must be of the same
TYPE.
Type Conversion
When necessary, BASIC will convert a numeric constant from one TYPE to
another. The following rules and examples apply:
1, 2, 3...
1. If the numeric data on the right side of an assignment statement differs from
the type of data on the left side, the right side is converted to match the left.
However, character data cannot be converted to numerical data, or vice ver-
sa.
Example:
A = 12.3: if A is an integer then, “12” is assigned to A.
2. Double-precision data is converted to single-precision data when assigned
to a single-precision variable.
Example:
IF “A” is a single-precision variable and the statement:
LET A = 12.3456789# occurs in a program, then 12.3456789# will be con-
verted to a single-precision number and then assigned to “A.”
3. When an arithmetic operation is performed using both single-precision and
double-precision values, the single-precision value is converted to
double-precision first, and then the operation is performed. Therefore, the
result is a double-precision value.
Example:
0#/3 (double-precision)
4. In logic operations, all numeric data is first converted into integer data. If any
value cannot be converted into an integer within the range of –32768 to
32767, an error will occur.
Example:
LET A = NOT 12.34, –13 is assigned as A.
5. When a real number is converted into an integer, everything to the right of
the decimal point is rounded off.
Example:
A = 12.3: “12” is assigned to A.
Expressions
Expressions refer to constants, variables, and functions that have been com-
bined by operators. Numeric values, variables, or characters alone can also
form expressions. There are four types of expressions:
•
Arithmetic
Program Configuration
Summary of Contents for C500-ASC04
Page 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...
Page 5: ...iv ...
Page 7: ...vi ...