Section 7. Installation
'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