Why worry about it RPG when you don't appear
to be worried about it Excel?
Given that Excel apparently stores numbers as floating
point and that there are differences between floating
point arithmetic and RPG's fixed decimal arithmetic...
expecting the same results is probably a fantasy.
Personally, I'd consider RPG's fixed decimal answer "right" over
Excel's floating point answer when dealing with real world values
especially for currency.
However, if you want to consider Excel's floating point
answer "right", it would behoove you to use floating
point variables in RPG to match.
The true "right" solution in my mind
1) use RPG fixed point
2) Understand RPG's fixed point precision rules
3) use %round() and/or %dec() as needed to control intermediate
results as you want.
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.