Hello,

I hope this is the right place for this.

Macro \int_div_truncate_raw:nn is defined in file l3int as:

\def_new:Npn \int_div_truncate_raw:nn #1#2 {
  \int_eval:n{ (2*#1 - #2) / (2* #2) }
}

If #1 is zero and #2 is two, this macro does not expand to zero,
as one would expect (0 / 2 = 0), but to -1 (since eTeX rounds
negative numbers by negating them, rounding the positive number
and negating the result. See function "quotient" in etex.ch).

Also, if #2 is an expression (i.e. 1+1), the calculation is not
performed correctly, since #2 (and #1) is not surrounded by ( and ).
(I am not sure if this can happen, or if the parameters are always
evaluated beforehand)

In my code, I use (to divide #1 by #2):

\numexpr((((#1)+((#2)/2))/(#2))-1)\relax

This seems to work better.


HTH,
Jonathan