EasyManuals Logo

Campbell CR800 Series User Manual

Campbell CR800 Series
598 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #162 background imageLoading...
Page #162 background image
Section 7. Installation
162
Boolean from FLOAT or LONG
When a FLOAT or LONG is converted to a Boolean as shown in CRBasic
example Conversion of FLOAT / LONG to Boolean
(p. 162), zero becomes false (0)
and non-zero becomes true (-1).
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
LONGs are evaluated in expressions as integers when possible. CRBasic example
Evaluation of Integers
(p. 162) illustrates evaluation of integers as LONGs and
FLOATs.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Campbell CR800 Series and is the answer not in the manual?

Campbell CR800 Series Specifications

General IconGeneral
BrandCampbell
ModelCR800 Series
CategoryData Loggers
LanguageEnglish

Related product manuals