On Fri, Oct 28, 2011 at 10:56 AM, Hans Hagen <pra...@wxs.nl> wrote:
> Hi Thomas,
>
>> thanks for your explanations! The point of my question was: can I feed
>> the content of tex.dimen["textwidth"] directly back to TeX, and the
>> answer to this appears to be "no"; you need to add some unit to it
>> (otherwise, you get an error message). Which was a bit confusing to me
>> at first, because the name tex.dimen implies that it holds a "real"
>> dimension, like \newdim does.
>
> Just switch to philosopher mode for a while and ask yourself what
> implications that would have in the rather fuzzy world of printing.
>
> What is a 'real' dimension? What we call points (pt) is in other application
> also called points but happens to be basepoints in our universe (bp). Also,
> imagine that in good american tradition the dimension would have been inches
> while we all moved on to meters ...
>
> So, Knuth foresaw this (and also wanted predictable calculations and wanted
> to avoid unportable floating points) so he came up with his own unit: scaled
> points.
just to see the floating point in action:
\starttext
\startluacode
context(collectgarbage('count')," KB are ",collectgarbage('count')*1024," byte")
\stopluacode
\stoptext


collectgarbage('count')  returns the total memory in use by Lua (in Kbytes).

>
> At the lua end all are just integers (with some limited size but that might
> change as Taco and I want to play a bit with adding a couple of bytes and
> see to what extent that will break things).
hm, I'm bit loss here.
In CWEB I see
define max_dimen        0x3FFFFFFF
so I suppose that it's a kind of int
But the type of tex.dimen is number as is the type of math.sqrt(2) as
we can see in
context(type(tex.dimen['textwidth']))
context(type(math.sqrt(2)))

i.e it's a Lua number -- a floating point.
So a kind of conversion can happen between a  floating point and a sp
number (which has a limited range)
Of course Lua has its routines, but probably they differs from TeX
If I recall correctly, both use 32 bits, but if you extend to lets say
48 bit then the TeX routines are not good anymore.

Well, I'm not sure it's right, of course.



-- 
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to