[NTG-pdftex] [ pdftex-Bugs-752 ] nc/nd broken
noreply at sarovar.org
noreply at sarovar.org
Wed Apr 4 08:37:38 CEST 2007
Bugs item #752, was opened at 2007-04-03 14:50
You can respond by visiting:
http://sarovar.org/tracker/?func=detail&atid=493&aid=752&group_id=106
Category: Primitives
Group: v1.30.0
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Martin Schröder (oneiros)
Assigned to: Martin Schröder (oneiros)
Summary: nc/nd broken
Initial Comment:
David Kastrup reports this:
------------------------
**\dimen0=1nc
*\showthe\dimen0
> 12.80373pt.
<*> \showthe\dimen0
?
*\dimen0=0.99998nc
*\showthe\dimen0
> -0.09723pt.
<*> \showthe\dimen0
?
This does not cut it at all. The section in tex.web
starts with
@ The necessary conversion factors can all be specified
exactly as fractions whose numerator and denominator
are 32768 or less.
In LuaTeX, the section brazenly starts with
@ The necessary conversion factors can all be specified
exactly as fractions whose numerator and denominator
are 65535 or less.
Who does things like that without actually checking
that they work? It is possible to rework the arithmetic
to get along with 65535, but it is certainly not a
matter of merely changing the _documentation_
and not the code.
I have no idea whether this is an eTeX, a PDFTeX, an
Aleph or a LuaTeX invention (did I forget anything?),
but it certainly can't stay like that.
Sorry if I sound like a whiner here. If you think it
worth the trouble, I can rework the arithmetic (but
there is a reason that Knuth kept to 15 bit factors, so
it is going to become more complicated).
But I consider it more likely that nc should be changed
to 1370:107 which is the closest 15 bit fraction to
12nd (it is smaller than 12nd, but the next larger
suitable fraction 32163:2512 is slightly further
from 12nd). Please remember that in TeX, 2in is not
equal to 1in+1in anyway. I think we can afford this.
Certainly better than the current behavior.
------------------------
He tested it with luaTeX, but the bug is already in pdftex.
----------------------------------------------------------------------
Comment By: Nobody (None)
Date: 2007-04-04 12:07
Message:
Logged In: NO
Unfortunately, Knuth's original comment is _also_ wrong.
The _sum_ of numerator and denominator must not exceed 32768.
So the conversion ratio for nd is _also_ incorrect, as can
be witnessed by checking the value 9.99998nd.
Changing the ratio to 685:642 would reconstitute the
relation 12nd=1nc. The closest approximation for nd that
works with the code would be 11183:10481. However, we are
talking about differences in the order of 1e-7, so the ratio
with the simpler relation to nc might be preferable.
----------------------------------------------------------------------
Comment By: Martin Schröder (oneiros)
Date: 2007-04-03 15:13
Message:
Logged In: YES
user_id=421
A patch is attached; this will be included in the next release.
----------------------------------------------------------------------
You can respond by visiting:
http://sarovar.org/tracker/?func=detail&atid=493&aid=752&group_id=106
More information about the ntg-pdftex
mailing list