Int, fix – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 186

Advertising
background image

Section 8. Processing and Math Instructions

8-14

If expression1 is

And expression2 is

The result is

True

True

True

True

False

False

True

Null

Null

False

True

True

False

False

True

False

Null

True

Null

True

True

Null

False

Null

Null

Null

Null

The IMP operator performs a bitwise comparison of identically positioned bits
in two numeric expressions and sets the corresponding bit in result according
to the following table:

If bit in expression1 is

And bit in expression2 is

The result is

0

0

1

0

1

1

1

0

0

1

1

1

Int, Fix

Return the integer portion of a number.

Syntax
Int (
source)

Fix (source)

Remarks
The source can be any valid numeric expression. Both Int and Fix remove the
fractional part of source and return the resulting integer value.

If the numeric expression results in a Not-a-Number, Int and Fix return a Not-
a-Number.

The difference between Int and Fix is that if number is negative, Int returns
the first negative integer less than or equal to number, whereas Fix returns the
first negative integer greater than or equal to number. For example, Int
converts -8.4 to -9, and Fix converts -8.4 to -8.

Fix(number) is equivalent to:
Int and Fix Function Example

This example illustrates the use of Int and Fix.

Advertising