Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is a more accurate way to round numbers than Round(
Message
From
18/09/2003 12:01:09
 
 
To
18/09/2003 05:52:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00830026
Message ID:
00830355
Views:
24
Hi Fabio,

Thanks for the reply.

INdexing the tables before sum has no effect on the outcome of Round(). It is not a problem for me as I have already determined that it is close enough for my purposes. About 95% of the time, it comes out equal to 4 decimal places. The other times it was off by .0001 which was due to Round() not actually rounding the numbers correctly. I was just curious why round() would yield different results for the same number that was manually entered than the result of a calculation.


The result from SUM was determined by
?str(m.lnTotalAVG1,30,18)
*!* result = 58271.270049999900000000
?Round(m.lnTotalAVG1,4)
*!* result = 58271.2701

*!*Manually entered same number
m.lnTotalAVG1 = 58271.270049999900000000
?Round(m.lnTotalAVG1,4)
*!* result = 58271.2700


>Hi Elmer,
>
>>Set decimals to 4
>this not set sum rounding, but only display rounding.
>Any calculation is done on floatig point.
>
>try this:
>
>* order the sum computation
>select EMISSIONUNITREPORT2
>INDEX ON EMISBYAVG TAG TAGTEMP
>sum EMISBYAVG to m.lnTotalAVG
>
>select EMISSIONUNITREPORT3
>INDEX ON EMISBYAVG TAG TAGTEMP
>sum EMISBYAVG to m.lnTotalAVG1
>.... test
>
>
>Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform