Section 7. Installation
220
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. 220)
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. 220)
•
Floating-Point Math, NAN, and ±INF
(p. 557)
•
TABLE: Data Types in Variable Memory
(p. 187)
All arithmetic in the CR6, and all declared variables, are single precision IEEE
four-byte floating point unless forced otherwise.
Declare variables as double precision by declaring the data type
As Double
. For
example:
DIM
ND
As Double
'Declares ND as double precision IEEE eight-byte
floating point
Arithmetic that involves a single-precision variable or number always has a
single-precision result. To force double-precision arithmetic, declare all involved
variables
As Double
and append all involved numbers with
R
.
Note
To force double-precision arithmetic, declare all involved variables
As Double
and append all involved numbers with
R
.
Содержание CR6 Series
Страница 2: ......
Страница 4: ......
Страница 6: ......
Страница 32: ......
Страница 36: ......
Страница 38: ......
Страница 76: ...Section 5 Overview 76 FIGURE 20 Half Bridge Wiring Example Wind Vane Potentiometer ...
Страница 80: ...Section 5 Overview 80 FIGURE 23 Pulse Input Wiring Example Anemometer ...
Страница 136: ......
Страница 251: ...Section 7 Installation 251 FIGURE 46 Running Average Frequency Response FIGURE 47 Running Average Signal Attenuation ...
Страница 454: ...Section 8 Operation 454 FIGURE 104 Narrow Sweep High Noise ...
Страница 459: ...Section 8 Operation 459 FIGURE 106 Vibrating Wire Sensor Calibration Report ...
Страница 535: ...Section 8 Operation 535 8 11 2 Data Display FIGURE 121 CR1000KD Displaying Data ...
Страница 537: ...Section 8 Operation 537 FIGURE 123 CR1000KD Real Time Custom ...
Страница 538: ...Section 8 Operation 538 8 11 2 3 Final Storage Data FIGURE 124 CR1000KD Final Storage Data ...
Страница 539: ...Section 8 Operation 539 8 11 3 Run Stop Program FIGURE 125 CR1000KD Run Stop Program ...
Страница 541: ...Section 8 Operation 541 FIGURE 127 CR1000KD File Edit ...
Страница 542: ...Section 8 Operation 542 8 11 5 PCCard Memory Card Management FIGURE 128 CR1000KD PCCard Memory Card Management ...
Страница 546: ......
Страница 549: ...Section 9 Maintenance Details 549 FIGURE 133 Separate Back Shell from Module FIGURE 134 Disconnect Battery Connector ...
Страница 552: ......
Страница 610: ...Section 11 Glossary 610 FIGURE 137 Relationships of Accuracy Precision and Resolution ...
Страница 612: ......
Страница 648: ......
Страница 650: ......
Страница 688: ......
Страница 689: ......