“div” makes a truncated division (takes integer part of the division, without rounding).
But, for the rounded division: is it rounded towards zero or rounded towards infinity?
This makes a huge difference for negative numbers: in the first case “-3 / 2” returns -1, in the second one, it returns -2.
Note: doing a test, both (-3 / 2) and (-3 div 2) return -1. So why there is a difference in the description of the two operators in the documentation?
IIRC Both operators behave the same way int regular Oxygene mode, with the operands deciding the result type (eg integer/interg → integer, integer/double → double). In Delphi Compatibility Mode, / will always create a double, while div (iirc) always creates an integer — eseetally they behave the same way they do in Delphi.
it should be rounded according to proper math rules. ice 2.4 → 3,. 2.5 → 3
That’s what bugs://84528 was logged for, FTR, I just wanted Carlo’s final feedback before deciding whether to doc what it does now vs changing anything compiler side.