Skip to main content

$trunc

The $trunc operator truncates the first number to the specified number of decimal places (rounds towards zero).

Input

  • An array containing exactly two numeric values: the number to truncate and the number of decimal places

Output

  • The first value truncated to the specified number of decimal places

Examples

Truncate to Integer

Result: 3

Truncate to One Decimal Place

Result: 3.14

Truncate Negative Number

Result: -3

Field Value

Result: The value field truncated to 1 decimal place