Numeric functions: Abs, Int, NoRound and Round
Distinguishes absolute value, integer part, truncation and rounding.
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.)
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 Nil12; 12; 12.7; 12.8. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- 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.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.