[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua number type and 64-bit machines
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 6 Mar 2009 08:15:38 +0200
Asko has produced his LNUM patch which allows for extra number types.
I use it on my little ARM devices where I need floating-point but
where it would be slow to make everything run as a double (emulated
floating-point!), so I can have doubles and regular longs in the same
Lua. Works rather nicely, but you do need to patch the source.
steve d.
On Fri, Mar 6, 2009 at 7:49 AM, John Barham <jbarham@gmail.com> wrote:
> Hi all, Lua newbie (but long-time C and Python programmer) here, and
> apologies if this issue has already been resolved.
>
> Given the following:
>
> 1. Lua's number type is conventionally a typedef for 64-bit double
> precision floating-point numbers
> 2. 64-bit floats can only represent integers up to 53 bits of precision
> 3. 64-bit machines are becoming increasingly popular
>
> is there a case for adding a separate integer numeric type to Lua? Or
> would it be feasible to emulate Python's arbitrary precision "long"
> integer type that is automatically created on overflow?
>
> I appreciate that currently having only one numeric type helps keep
> Lua simple, but I fear that on 64-bit machines Lua's number type might
> not be able to represent common integer values such as process ids or
> file offsets.
>
> John
>