trunc() Function

Function

trunc( value, numberOfDecimals )

Truncates a decimal number to the specified number of places after the decimal point.

Parameters

Keyword Type Description

value

Decimal

A decimal number.

numberOfDecimals

Number

The number of places after the decimal point to which the number should be truncated.

Returns

Decimal

Usage considerations

If the numberOfDecimals parameter is not specified, a default value of 0 is used and the decimal number is truncated to just its integer value.

Examples

You can experiment with this function in the test box below.

Test Input

trunc(7.3675,2) returns 7.36

Open in Github Built: Fri, Sep 17, 2021 (04:05:09 PM)

On This Page

FEEDBACK