lua-users home
lua-l archive

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


In message <CAPweGw4UupjkiHLAnjSQHrUZYSqrY-wovf7x9zjwtQEPQoBCDw@mail.gmail.com>
          Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:

>On Fri, Apr 2, 2021 at 1:51 AM Phil Leblanc wrote:
>
>> I would like to build Lua 5.3+ with only support for Integer numbers

Has Phil Leblanc seen Vicente's No Floating-Point Option for Lua 5.3
at http://lua-users.org/wiki/LuaPowerPatches ?

I built a version of Lua 5.3.5 for RISC OS  with no floating point numbers
but with the imath library to provide big integers. It has two integer types
'int32' (32-bit integers) and 'integer' (arbitrary size), informally 'small'
and 'big'. The function 'type' is redefined, and the metatable of the imath
library is given a key __type = "integer" .  A function imath.$ converts
small integers to big ones, and the values $0, ... , $9 are predefined in
a prelude.

For example:

print ($2^($2^10))  -->
179769313486231590772930519078902473361797697894230657273430081157732675805500
963132708477322407536021120113879871393357658789768814416622492847430639474124
377767893424865485276302219601246094119453082952085005768838150682342462881473
913110540827237163350510684586298239947245938479716304835356329624224137216


--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/