Trunc Function

Official Content
This documentation is valid for:

To truncate the value of a given numeric expression.

Syntax

Trunc(numeric-expression, nK)

Type Returned:
Numeric

Where:
numeric-expression
    Must be a numeric expression containing constants, attributes, GeneXus functions or variables.

nK
    Must be a non-negative numeric constant or variable.

Description

Truncates the value of numeric-expression  to nK decimals.

Examples

Trunc(1.5, 0) = 1
Trunc(1.4, 0) = 1
Trunc(1.25, 1) = 1.2
Trunc(1.24, 1) = 1.2

&var = 0 
&sum = 146
&count = 10
&avg = Trunc(&sum / &count , &var) // Result: &avg = 14

Scope

Objects: Procedures, Transactions, Web PanelsWork Panels
Languages: .NET, Java, Ruby, RPG, Cobol, Visual FoxPro

See Also

Round Function
Truncate Method








Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.