Round Function error?

Discussion created by AjEGfmTech on Nov 6, 2012
Latest reply on Nov 6, 2012 by keywords

I have found what appears to be an error, at least by my way of thinking.


I am using the following simple calculation in a calculation field (Royalty) for a daily sales entry where 'DaySalesNet' is the daily net sales and 'Stores:RateRoyalty' is the royalty rate for that store.

Royalty = Round ( DaySalesNet * Stores::RateRoyalty ; 2 )


I have created a summary field (TotalRoyalty) to get the total of 'Royalty' when sorted by 'StoreID' with a running total where the summary is restarted for each sorted group.


A sub-summary part is used in a report that shows the weekly totals for sales and royalties.


Following are the results I'm getting which make me think there is an error in how the 'Round' function is working.


RateRoyalty = 0.06

Total of DaySalesNet = 6,487.73

Total of Royalty = 389.27


The calculated amount for 6,487.73 * 0.06 is 389.2638. This SHOULD round to 389.26, but instead it rounds to 389.27. This rounding error only occurs if I have the 'Royalty' Round function precision set to '2'. If I set the function precision to 4 or just remove the Round function altogether, the expected 389.26 occurrs.


Is this an error of the function or is this just the accumulated error when getting the Total of seven days of Royalty amounts?


I think I may have just answered my own question, but I am interested in other thoughts. Thanks.