Information Technology Reference
In-Depth Information
will be .1, and .2 if rounding takes place. The more precise answer is about .208 so we are
a bit off. Now using 2 decimal digits,
w
will be .33 and
x
will be .62. The result for
b
will be .20 whether we use rounding or not. It doesn't look like that extra decimal digit
made too much of a difference. Using 3 decimal digits results in
y
being .333 and
z
being .625. Now this results in the variable
c
having the value of .208. This will come about with or without rounding. As you can see,
that is about the result we wanted and it is a great deal more accurate than the .1 we
arrived at initially.
Suppose we had the following:
define c decimal (3.3)
define y decimal (3.3)
define z decimal (3.3)
y = 1/3
z = 3/4
c = y * z
and if we didn't skip the class on multiplying fractions, we expect a result of exactly .250
for the last calculation. To start with we will have .333
for
y
and .750 for
z .
The value of
c
results in the value of .249 if no rounding occurs and .250 if it does. You can see that
using more decimal digits gets us closer to the result we expect from normal math.
As we have seen, we may have differences even if we round results and in some
cases that may even be the reason for the unexpected. Not rounding may still create a
problem as we have seen in our sample reports but the important thing to realize is why
there is a difference. Your job is to explain that discrepancy as well as minimize the
damage. That simply means that you may have to allow more decimal digits than you
originally had. This is probably more of a warning than anything else. You will need to
realize than sometimes no matter what you do, there is nothing further to be done.
Search WWH ::




Custom Search