LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Transfer-Encoding: 8bit
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Jonathan Sauer <[log in to unmask]>
Date: Thu, 8 Nov 2007 09:30:06 +0100
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments: text/plain (30 lines)

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

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):


This seems to work better.