Kbase 17685: Use TRUNCATE Function to ROUND Up to a Whole Number.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  8/6/1999 |
|
Use TRUNCATE Function to ROUND Up to a Whole Number.
You can use the TRUNCATE function to round up to the next whole
number.
IF x > TRUNCATE(x, 0)
THEN ASSIGN x = TRUNCATE(x, 0) + 1.
ELSE ASSIGN x = TRUNCATE(x, 0).
Or, to round down to the next whole number:
IF x > TRUNCATE(x, 0) THEN ASSIGN x = TRUNCATE(x, 0).
Sample code to round up:
def var x as decimal format "999.9999".
repeat:
update x.
if x > truncate(x, 0)
then assign x = truncate(x, 0) + 1.
else assign x = truncate(x, 0).
display x.
end.
JMA (2/11/98)
Reference to Written Documentation
==================================
Language Reference : TRUNCATE Function
ROUND Function
Progress Software Technical Support Note # 17685