Function Trunc(x)

# Trunc

Trunc(
x       ! (input) numerical expression
)


## Arguments

x

A scalar numerical expression.

## Return Value

The function Trunc returns the truncated value of x: $$\textrm{sgn} \left( x \right) \cdot \lfloor \mid x \mid \rfloor$$.

## Example

_p_returnA := Trunc(-1.00); ! returns -1
_p_returnB := Trunc(-0.99); ! returns  0
_p_returnC := Trunc( 0   ); ! returns  0
_p_returnD := Trunc( 0.99); ! returns  0


Note

• The function Trunc will round to the nearest integer, if it lies within the equality tolerances equality_absolute_tolerance and equality_relative_ tolerance.

• The function Trunc can be used in the constraints of nonlinear mathematical programs. However, nonlinear solver may experience convergence problems around integer argument values.

• When the numerical expression contains a unit, the function Trunc will first convert the expression to the corresponding base unit, before evaluating the function itself.

The functions Ceil, Floor, Round, Precision. Arithmetic functions are discussed in full detail in Arithmetic Functions of the Language Reference. Numeric tolerances are discussed in Arithmetic Functions of the Language Reference.