
Section 7. Installation
160
'DataTable(Name, TrigVar, Size)
DataTable
(Temp, TC > 100, 5000)
When the trigger is
TC > 100
, a thermocouple temperature greater than 100 sets
the trigger to
True
and data are stored.
7.6.3.16 Programming Expression Types
An expression is a series of words, operators, or numbers that produce a value or
result. Expressions are evaluated from left to right, with deference to precedence
rules. The result of each stage of the evaluation is of type Long (integer, 32 bits) if
the variables are of type Long (constants are integers) and the functions give
integer results, such as occurs with
INTDV()
. If part of the equation has a
floating point variable or constant (24 bits), or a function that results in a floating
point, the rest of the expression is evaluated using floating-point, 24-bit math,
even if the final function is to convert the result to an integer, so precision can be
lost; for example,
INT((rtYear-1993)*.25)
. This is a critical feature to consider
when, 1) trying to use integer math to retain numerical resolution beyond the limit
of floating point variables, or 2) if the result is to be tested for equivalence against
another value. See
Floating-Point Arithmetic
(p. 160)
for limits.
Two types of expressions, mathematical and programming, are used in CRBasic.
A useful property of expressions in CRBasic is that they are equivalent to and
often interchangeable with their results.
Consider the expressions:
x = (z * 1.8) + 32
'(mathematical expression)
If
x = 23
then
y = 5
'(programming expression)
The variable x can be omitted and the expressions combined and written as:
If
(z * 1.8 + 32 = 23)
then
y = 5
Replacing the result with the expression should be done judiciously and with the
realization that doing so may make program code more difficult to decipher.
7.6.3.16.1 Floating-Point Arithmetic
Related Topics:
•
Floating-Point Arithmetic
(p. 160)
•
Floating-Point Math, NAN, and ±INF
(p. 467)
•
TABLE: Data Types in Variable Memory
(p. 127)
All arithmetic in the CR800, and all declared variables, are single precision IEEE
four-byte floating point.
A few operations are performed as double precision. These are
AddPrecise()
,
Average()
,
AvgRun()
,
AvgSpa()
,
CovSpa()
,
MovePrecise()
,
RMSSpa()
,
StdDev()
,
StdDevSpa()
,
Totalize()
, and
TotRun()
.
Floating-point arithmetic is common in many electronic, computational systems,
but it has pitfalls high-level programmers should be aware of. Several sources
Summary of Contents for CR800 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 34: ......
Page 54: ......
Page 92: ......
Page 310: ......
Page 446: ...Section 8 Operation 446 8 11 2 Data Display FIGURE 100 CR1000KD Displaying Data ...
Page 448: ...Section 8 Operation 448 FIGURE 102 CR1000KD Real Time Custom ...
Page 449: ...Section 8 Operation 449 8 11 2 3 Final Storage Data FIGURE 103 CR1000KD Final Storage Data ...
Page 450: ...Section 8 Operation 450 8 11 3 Run Stop Program FIGURE 104 CR1000KD Run Stop Program ...
Page 452: ...Section 8 Operation 452 FIGURE 106 CR1000KD File Edit ...
Page 456: ......
Page 462: ......
Page 523: ...Section 11 Glossary 523 FIGURE 116 Relationships of Accuracy Precision and Resolution ...
Page 524: ......
Page 526: ......
Page 556: ......
Page 558: ......
Page 560: ......
Page 597: ......