Sender: |
|
Date: |
Mon, 5 May 2014 09:01:02 +0100 |
Reply-To: |
|
Message-ID: |
|
Subject: |
|
MIME-Version: |
1.0 |
Content-Transfer-Encoding: |
8bit |
In-Reply-To: |
|
Content-Type: |
text/plain; charset=windows-1252 |
From: |
|
Parts/Attachments: |
|
|
On 05/05/2014 00:08, Heiko Oberdiek wrote:
> Hello,
>
> 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_strip_pt:n
> {
> \__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
>
Altered in the trunk: will feature in the next release.
--
Joseph Wright
--
Joseph Wright Tel. 01604 810094
Morning Star Mobile 07974 148180
2 Dowthorpe End Skype josephawright
Earls Barton
Northants NN6 0NH
|
|
|