Posted by Robert G Laurin on May 12, 2015 at 12:21:01:
Just found out that Comet32 calculates differently than what we'd expect and always knew for Comet16.
My understanding of the rounding in calculation, has always been that all calculations were as precise as the most precise variable. The ROUND statement would allow me to round the result when moving it to my rounded variable.
So if I multiply & divide using a 8.2 and some integers, my intermediate result will be 8.2.
Amount=795 as 8.2
NoMo=3 as 3.0
Period=22 as 3.0
and Result as 8.2 ROUNDed
Result = Amount * NoMO / Period
108.40 = 795.00 * 3 / 22
Intermediate result (108.4090909090) is chopped at 2 decimals = 108.40 and is not rounded going into Result.
If I really want to round this, I would say:
Result = Amount * NoMO * 1.0000 / Period
Intermediate result would be 4 decimals = 108.4090 before moving into Result and thus would be rounded as 108.41
This has been working for ever.
In Comet32 the result is rounded (108.41) even if the most decimals is 2. This happens ONLY if RESULT is ROUNDed.
I wonder if the division is not the culprit....
In any case, it is a different behavior.
Tested with Comet32 2014.491 and Comet16 2012.472
Post a Followup
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.