Kbase P31476: How to round a decimal number up to the next nickel?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/07/2003 |
|
Status: Unverified
GOAL:
How to round a decimal number up to the next nickel?
FIX:
The following code shows how to round a decimal number up to the next nickel:
DEFINE VARIABLE DollarAmount AS DECIMAL NO-UNDO.
DEFINE VARIABLE Cents AS DECIMAL NO-UNDO.
UPDATE DollarAmount.
ASSIGN Cents = (DollarAmount - TRUNCATE(DollarAmount,0)) * 100.
IF Cents MOD 5 NE 0 THEN
ASSIGN DollarAmount = DollarAmount + ((5 - Cents MOD 5) / 100).
MESSAGE DollarAmount VIEW-AS ALERT-BOX.