ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: luigi scarso <luigi.scarso@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: xml and lua again
Date: Fri, 28 Oct 2011 13:23:46 +0200	[thread overview]
Message-ID: <CAG5iGsCvqZAFifzEUOaN1agXK_nvyucKgwJKQwURSzXLP4rvUg@mail.gmail.com> (raw)
In-Reply-To: <4EAA6E5A.8010606@wxs.nl>

On Fri, Oct 28, 2011 at 10:56 AM, Hans Hagen <pragma@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
___________________________________________________________________________________


  parent reply	other threads:[~2011-10-28 11:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-22 16:46 Thomas A. Schmitz
2011-10-23 14:04 ` Peter Rolf
2011-10-23 14:37   ` Thomas A. Schmitz
2011-10-23 15:25     ` Peter Rolf
2011-10-23 18:15 ` Peter Rolf
2011-10-24 10:17 ` Hans Hagen
2011-10-24 12:18   ` Thomas A. Schmitz
2011-10-24 12:26     ` Hans Hagen
2011-10-24 17:00       ` Thomas A. Schmitz
2011-10-24 18:48         ` Hans Hagen
2011-10-25  9:43           ` Thomas A. Schmitz
2011-10-25 10:10             ` Wolfgang Schuster
2011-10-25 10:17             ` Hans Hagen
2011-10-25 10:27               ` Thomas A. Schmitz
2011-10-27  9:23                 ` Thomas A. Schmitz
2011-10-27  9:53                   ` Wolfgang Schuster
2011-10-27 10:32                     ` Thomas A. Schmitz
2011-10-27 11:05                       ` Hans Hagen
2011-10-28  6:23                         ` Thomas A. Schmitz
2011-10-28  6:37                           ` luigi scarso
2011-10-28  6:43                             ` luigi scarso
2011-10-28  6:44                           ` Patrick Gundlach
2011-10-28  6:55                             ` Thomas A. Schmitz
2011-10-28  8:35                               ` Wolfgang Schuster
2011-10-28  8:59                                 ` Hans Hagen
2011-10-28  8:56                               ` Hans Hagen
2011-10-28 10:48                                 ` Thomas A. Schmitz
2011-10-28 11:23                                 ` luigi scarso [this message]
2011-10-28 11:42                                   ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG5iGsCvqZAFifzEUOaN1agXK_nvyucKgwJKQwURSzXLP4rvUg@mail.gmail.com \
    --to=luigi.scarso@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).