Section 7. Installation
223
Conversion of FLOAT / LONG to Boolean
'This program example demonstrates conversion of Float and Long data types to Boolean
'data type.
Public
Fa
As Float
Public
Fb
As Float
Public
L
As Long
Public
Ba
As Boolean
Public
Bb
As Boolean
Public
Bc
As Boolean
BeginProg
Fa = 0
Fb = 0.125
L = 126
Ba = Fa
'This will set Ba = False (0)
Bb = Fb
'This will Set Bb = True (-1)
Bc = L
'This will Set Bc = True (-1)
EndProg
FLOAT from LONG or Boolean
When a
LONG
or
Boolean
is converted to
FLOAT
, the integer value is loaded
into the
FLOAT
. Booleans are converted to
-1
or
0
.
LONG
integers greater
than 24 bits (16,777,215; the size of the mantissa for a
FLOAT
) will lose
resolution when converted to
FLOAT
.
LONG from FLOAT or Boolean
When converted to
Long, Boolean
is converted to
-1
or
0
. When a
FLOAT
is
converted to a
LONG
, it is truncated. This conversion is the same as the
INT
function (Arithmetic Functions). The conversion is to an integer equal to or less
than the value of the float; for example,
4.6
becomes
4
and –
4.6
becomes –
5
).
If a
FLOAT
is greater than the largest allowable
LONG
(+2,147,483,647), the
integer is set to the maximum. If a
FLOAT
is less than the smallest allowable
LONG
(–2,147,483,648), the integer is set to the minimum.
Integers in Expressions
LONG
s are evaluated in expressions as integers when possible. CRBasic example
Evaluation of Integers
(p. 223)
illustrates evaluation of integers as
LONG
s and
FLOAT
s.
Summary of Contents for CR6 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 76: ...Section 5 Overview 76 FIGURE 20 Half Bridge Wiring Example Wind Vane Potentiometer ...
Page 80: ...Section 5 Overview 80 FIGURE 23 Pulse Input Wiring Example Anemometer ...
Page 136: ......
Page 454: ...Section 8 Operation 454 FIGURE 104 Narrow Sweep High Noise ...
Page 459: ...Section 8 Operation 459 FIGURE 106 Vibrating Wire Sensor Calibration Report ...
Page 535: ...Section 8 Operation 535 8 11 2 Data Display FIGURE 121 CR1000KD Displaying Data ...
Page 537: ...Section 8 Operation 537 FIGURE 123 CR1000KD Real Time Custom ...
Page 538: ...Section 8 Operation 538 8 11 2 3 Final Storage Data FIGURE 124 CR1000KD Final Storage Data ...
Page 539: ...Section 8 Operation 539 8 11 3 Run Stop Program FIGURE 125 CR1000KD Run Stop Program ...
Page 541: ...Section 8 Operation 541 FIGURE 127 CR1000KD File Edit ...
Page 546: ......
Page 552: ......
Page 610: ...Section 11 Glossary 610 FIGURE 137 Relationships of Accuracy Precision and Resolution ...
Page 612: ......
Page 648: ......
Page 650: ......
Page 688: ......
Page 689: ......