Rounding

Purpose

Round floating point signal to integer values

Library

Control / Math

Description

../../_images/rounding.svg

This component rounds the value of a floating point signal on its input to an integer value. The rounding algorithm can be selected in the component parameter:

floor

The output is the largest integer not greater than the input, for example \((1.7) = 1\) and \((-1.3) = -2\).

ceil

The output is the smallest integer not less than the input, for example \((1.3) = 2\) and \((-1.7) = -1\).

round

The output is the integer nearest to the input, for example \((1.4) = 1\), \((-1.3) = -1\) and \((-1.5) = -2\).

fixed

The output is the integer value of the input with all decimal places truncated, for example \((1.7) = 1\) and \((-1.7) = -1\).

Parameters

Operation

The rounding algorithm as described above.

Output data type

The data type of the output signal. See Data Types.

Data type overflow handling

Specifies how a data type overflow is handled. See Data Types. This parameter only appears if is not set to a floating-point data type.

Probe Signals

Input

The block input signal.

Output

The block output signal.