Kbase P15974: Report Builder ROUND function does not always round up correctly
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  27/01/2006 |
|
Status: Unverified
SYMPTOM(s):
Report Builder
ROUND function generates the wrong result
ROUND function works in some cases but not in others
Working Example:
ROUND(123.455,2) results in 123.46 (correct)
Failing Example:
ROUND(140.855,2) results in 140.85 (incorrect), but instead of 140.86 (correct)
Equivalent ROUND statement in 4GL generates the correct result
CAUSE:
Bug# 19981102-087
FIX:
Create a User Defined Function (UDF) with to handle values ending in 5.
1) In Report Builder, select Calculations > User Defined Function...
2) Click the New button
3) Enter the name of the new UDF
4) Enter the following in the Expression box:
((x * 100) + .5) / 100
5) Click the New button to create a new Parameter
6) Configure as follows:
Parameter Name: x
Parameter Type: Numeric
7) Click OK
8) Click OK again to add the UDF
The UDF will now be accessible from the Function listing.
The formula will generate a result that is rounded to 2 decimal places. This could be altered for greater degrees of accuracy.