Focal Point
Rounding up problem

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1181087331

July 05, 2004, 06:32 PM
reFOCUSing
Rounding up problem
I'm having problems with a computed field I created that multiplies two fields together. I'm trying to create a field that is a D6.2. In one case manually doing the calculation gives the result 0.555 which should roundup to 0.56 but the report produces 0.55, how can this be corrected?

I have searched the technical support and it told me to add .000000001 to the value, this will work but I don't like it. There has to be a better way.

Here a link to the article: http://techsupport.informationbuilders.com/sps/32101095.html
July 05, 2004, 06:50 PM
Leah
The lovely rules of rounding I found, what are your two numbers you are trying to multiply?

Of course which rule IB has in force for the '5' option may be why it isn't working. Some people truncate if the number in the next position is '5' regardles.


According to Hurlburt, 1994 pg. 12,the procedure for finding the last digit of a measure is called "Rounding".

There are three general rules for rounding:



Rule 1- if the remainder beyond the last digit to be reported is less than 5, drop the last digit. Rounding to one decimal place, the number 5.3467 becomes 5.3.


Rule 2-if the remainder is greater than 5, increase the final digit by 1. The number 5.798 becomes 5.8 if rounding to 1 digit.


Rule 3- To prevent rounding bias, if the remainder is exactly 5, then round the last digit to the closest even number.Thus the number 3.55 (rounded to 1 digit) would be 3.6 (rounding up) and the number 6.450 would round to 6.4 (rounding down)if rounding to 1 decimal.
See page 12 in Hurlburt, R. (1994) Comprehending Behavioral Statistics, Brooks/Cole, Pacific Grove, CA.
July 05, 2004, 09:59 PM
GCohen
Focus would round a decimal number valued
at .555 to .56 but you probably have
a full value of only .5549999 , which appears
under format D8.3 as .555 .
Increase your format to say D8.5 and see
what the value is.
July 05, 2004, 10:22 PM
reFOCUSing
The numbers I'm mulitply are 48.47 and 86.50 that give the value of 4192.655
July 16, 2004, 08:35 PM
reFOCUSing
Here is the solution to this problem.

TABLE FILE CAR
PRINT
SEATS NOPRINT
COMPUTE TEST1/D8.2 = 48.47 * 86.50 ;
COMPUTE TEST2/P8.2 = 48.47 * 86.50 ;
WHERE RECORDLIMIT EQ 1
END

If I changed the D8.2 to a P8.2 is will round the value up.