[luatex] Will the next version of LuaTeX allow integer up to 2^(63)-1?

Reinhard Kotucha reinhard.kotucha at web.de
Sun Oct 4 04:57:29 CEST 2015

On 2015-10-04 at 00:36:08 +0200, Hans Hagen wrote:

 > On 10/3/2015 3:06 AM, Reinhard Kotucha wrote:
 > > On 2015-10-02 at 17:11:35 +0200, Hans Hagen wrote:
 > >
 > >   > going 64 bit internally in tex would mean a lot of checking and
 > >   > patching of code
 > >
 > > Does it really matter whether a user specifies a number which is too
 > > large in his TeX input file or whether such a number comes from Lua?
 > hard to say but sometimes tex packs data together so casts happen (many 
 > internals are so called halfwords)

Sure, but a number in a TeX input file is a string and TeX has to
convert it to a number.  Maybe it's possible to convert a Lua number
to a string and feed it to TeX at a point where TeX expects a string,
i.e. before TeX converts strings to numbers.  It doesn't matter then
how TeX stores numbers internally. 

I must admit that it's difficult to decide whether 64 bit numbers are
useful or not.  But it would certainly be annoying if texlua can't
read the xref table of a PDF file (10^{10} > 2^{32}).  This seems to
work even with Lua 5.1 on a 64 bit system but numbers with more than
14 decimal digits are converted to floating point numbers.

 | $ lua
 | Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 | > x=12345678901234
 | > print (tonumber (x))
 | 12345678901234
 | > x=123456789012345
 | > print (tonumber (x))
 | 1.2345678901234e+14

Can anybody confirm that the output is the same on a 32 bit system?

It's clear to me that Lua has to be frozen in LuaTeX former or later.
But since LuaTeX can be considered "not stable" ATM I think that
changes can be made more easily ATM rather than later.


Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha at web.de

More information about the luatex mailing list