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-Type: text/plain; charset=windows-1252
Date: Mon, 5 May 2014 01:08:37 +0200
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
MIME-Version: 1.0
Message-ID: <[log in to unmask]>
Content-Transfer-Encoding: 8bit
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Heiko Oberdiek <[log in to unmask]>
Parts/Attachments: text/plain (37 lines)

macro \__dim_strip_bp:n is defined in l3skip.dtx the following way:

  \cs_new:Npn \__dim_strip_bp:n #1
    { \__dim_strip_pt:n { 0.996 26 \__dim_eval:w #1 \__dim_eval_end: } }

The calculation from bp to bp is essentially:

    \dimexpr 0.99626\dimexpr #1\relax\relax

Of course, there will always be rounding errors, but the code
can be improved by a scaling operation inside e-TeX's \dimexpr,
from "The e-TeX manual":

| The arithmetic operations are performed individually, except
| for ‘scaling’ operations (a multiplication immediately followed
| by a division) which are performed as one combined operation
| with a 64-bit product as intermediate value.

Improved version with higher precision:

  \cs_new:Npn \__dim_strip_bp:n #1
          \__dim_eval:w ( #1 ) * 800 / 803 \__dim_eval_end:

* 800/803 is the integer fraction for 72/72.27
* The parentheses around #1 ensure, that #1 is
  calculated first.

Yours sincerely
  Heiko Oberdiek