When trying to round the result of a calculation directly, then the round command does not round to the next integer, if the whole term is not covered in parantheses. When saving the result of the calculation in a variable and then do a round on the variable it works fine.
Description
Description
Details
Details
- Severity
- Minor
- Resolution
- Not A Bug
- Reproducibility
- Always
- Operating System
- Windows 7
- Category
- General
Steps To Reproduce
Simple example for a wrong result
round (3+4)/3 -> 2.33333
but
round ((3+4)/3) -> 2
and
_calc = (3+4)/3
round _calc -> 2
gives the correct result.
Event Timeline
Comment Actions
It's not a bug. That's how the expressions are prioritized.
round (3+4)/3 calculates round (7) first, then divides it by 3.
https://community.bistudio.com/wiki/SQF_syntax#Rules_of_Precedence