Official Content

Truncates the value of a given numeric expression.

Syntax

Numeric-expression.Truncate(nK)

Where:

Numeric-expression
     Is a Numeric expression that indicates the number the method will be applied to.

nK
    Must be a non negative numeric constant.

Type Returned:
Numeric

Scope

Data Types: Numeric
Generators: .NET, .NET Framework, Java, RPG, Cobol, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

Description

Truncates the value of Numeric-expression  to nK decimals.

Samples

&Val = 1.5
&Val.Truncate(0)      // Result: 1

&Val = 1.4
&Val.Truncate(0)      // Result: 1

&Val = 1.25
&Val.Truncate(1)      // Result: 1.2

&Val = 1.24
&Val.Truncate(1)      // Result: 1.2 

See Also

Trunc function
Round function
Round method










Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant