Skip to content

Round

See Also: Math Functions, Integer, Number, Real

Purpose

Round returns a LongPtr value from a variable of another numeric type by rounding the decimal portion.

Return Type

LongPtr

Syntax

(Round({expression}))

What It Does

Round returns {expression} rounded to the nearest LongPtr value. When the decimal portion of the {expression} is .5 or more, it is rounded up; otherwise, it is rounded down.

Move (Round(8.3782)) to lpSample

In this example, the value 8 is moved to lpSample.

Round rounds negative numbers whose decimal value exceeds 0.5 downward.

Move (Round(-6.6)) to lpSample

In this example, the value -7 is moved to lpSample.

Notes

  • When used inside an expression, Round affects only the precision of its own expression, not that of the evaluation of the overall expression.
Move (3.14 * Round(nMean)) to lpResult

This example would output 3.14 times the rounded value of the number variable nMean to the LongPtr variable lpResult in the full precision of number variables.