beautypg.com

Round(source, decimal), Rnd function – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 318

background image

Section 8. Processing and Math Instructions

Parameter
& Data Type

Enter

RMSSPA PARAMETERS

Dest

Variable

The variable in which to store the RMS value.

Swath

Constant

The number of values of the array to include in the RMS calculation.

Source

Array

The name of the variable array that is the input for the instruction.

Round(Source, Decimal)

The Round function rounds a value to a higher or lower number.

Syntax

Variable = Round(

Source, Decimal

)

Remarks

The Round function rounds the Number up if the determining digit is 5 or
greater; otherwise, it rounds down. This is commonly referred to as arithmetic
rounding. Negative numbers effectively round down if the determining digit is
greater than 5 and up if it is less than 5; e.g., -8.6 rounds to -9.

To round a value up or down to an integer, use the Ceiling function or the
Floor function.

Number The Number parameter is the value on which to perform the rounding
operation. It can be any value or expression.

Decimal The Decimal parameter is used to determine how many decimal places
to keep. If Decimal is set to 0, the result will be an integer. If Decimal is a
negative number, it specifies the power of 10 to which you want to round.

Examples:

Function Value

Returned

Round(172.345, 2)

172.35

Round(-172.345,2)

-172.35

Round(172.345, 0)

172

Round(172.234, -2)

200

RND Function

Returns a random number.

Syntax

RND

[

(

number

)

]

Remarks
The argument number can be any valid numeric expression.

The RND function returns a Single value less than 1 but greater than or equal to 0.

The value of number determines how RND generates a random number:

Value of number

Returned Value

< 0

The same number every time, as determined by number.

> 0

The next random number in the sequence.

= 0

The number most recently generated.

number omitted

The next random number in the sequence.

8-32