Usina BRAdvPL Guide
Sign in
← All topics
FOUNDATIONUnder review

Numeric functions: Abs, Int, NoRound and Round

Distinguishes absolute value, integer part, truncation and rounding.

Numeric functions: Abs, Int, NoRound and RoundAdvPL
01 · OVERVIEW

Overview

Abs removes the sign and Int discards fractional digits. NoRound truncates to a decimal count whereas Round rounds. Int documentation records floating-point limitations for calculated values; Round also depends on AppServer precision configuration. STR formatting is not a rounding policy. The example uses binary-representable 12.75 without defining fiscal or monetary rules. (Sources: refs. 1–4.)

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed410()
    // Compare operations before choosing the rule.
    ConOut(cValToChar(Abs(-12)))
    ConOut(cValToChar(Int(12.75)))
    ConOut(cValToChar(NoRound(12.75,1)))
    ConOut(cValToChar(Round(12.75,1)))
Return Nil
Expected result

12; 12; 12.7; 12.8. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Validate boundaries, negatives and environment precision for actual rules.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Abs. TDN. Accessed on 2026-10-26.
  2. TOTVS. Int. TDN. Accessed on 2026-10-26.
  3. TOTVS. Round. TDN. Accessed on 2026-10-26.
  4. TOTVS. NOROUND(). TDN. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha