Houdini 20.5 Nodes APEX Nodes

Round

Rounds a floating point value to the nearest integer or to a specific number of decimal places.

On this page
Since 20.5

Rounds a floating point value to the nearest integer or to a specific number of decimal places, ndigits. At half way points, rounding is performed toward the even result. For example, both Round(0.5) and Round(-0.5) round to 0, and Round(1.5) rounds to 2.

Note

The rounding behavior can sometimes have unexpected results due to floating point numbers being represented internally using base 2 instead of represented exactly in base 10.

Inputs

val: Float

The input float value.

ndigits: Int

The number of digits after the decimal point to round to. ndigits can be set to any integer value (positive, zero, or negative). The default is 0, which results in rounding to the nearest integer.

Outputs

result: Float

val rounded to ndigits precision after the decimal point.

See also

APEX Nodes