lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Fri, Jul 21, 2006 at 09:07:49PM +0300, Asko Kauppi wrote:
> Hmm. The "int patch" discussed on the list a few times actually  
> allows you to use int64 and doubles, as well.

> This means, you'd get full int64 range for any integer numbers, and  
> doubles for the rest.

We use UNSIGNED 64 bit ints, and since they are random, about 50% of
them will have a bit pattern that will be "negative". This is why I
haven't looked at the patch before.

I suppose with some casting we can just convert the signed rep to
unsigned in our C code.  But when I want to represent 0xFAAACA297E488E35
in lua source, will I will have to first convert to decimal,
18062471535083949621, and then do something to figure out the
representation as a negative?

Maybe you see why long double sounds so interesting to me! Both signed
AND unsigned 64 bit integer varieties. Wow!

My goal is ease of use of our app domain numerics in lua, so the issue
of representation in lua source code isn't completely a seperate issue.
I understand lua's design rational, I even agree with it, but I sure do
miss the convenience of ruby here:

	  == 18062471535083949621
	  == 0o1752526242457622107065
	  == 0b1111101010101010110010100010100101111110010010001000111000110101

Even without arbitrary size integers (which would cause bloat in the lua
core and is out of the question), the appropriate representation for a
number depends on the application domain, and hex, binary, and octal all
have their places.  Lua's strength is application specific language
apps, so it would fit in, I think.

> Interested? :)

Sure I'm interested, I'll definitely give it a try and see how it works.

We use lua 5.0.2 (sorry, not my fault), so hopefully it isn't 5.1 specific.

Where can I find it?

I think thats the other reason I haven't used it yet, its hard to find
with google!