lua-users home
lua-l archive

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


In the last week I've been working on a new arbitrary precision integer
arithmetic library for Lua. I've mainly created it because
I needed a library that followed Lua 5.3+ integer semantics but could work
with large integers with efficiency in pure Lua, as none of the existing lua libraries
fitted my requirements I made this new one. Fully documented,
with a test suite covering all the code, with many examples and
being used already in some of my github projects.

Features:
* Small, simple and self contained
* Efficient (for a pure Lua integer library)
* Works with a fixed width integer
* Follows Lua 5.3+ integer arithmetic semantics by default
* All integer overflows wraps around
* Can work with large integer widths with reasonable speed (such as 1024bit integers)
* Implements all lua arithmetic operators (+, -, *, //, /, %) and bitwise operators (&, |, ~, <<, >>)
* Provide methods to work with unsigned arithmetic only
* Supports signed integers by default using two-complement arithmetic rules on unsigned operations
* Allow to mix any operation with lua numbers, promoting to lua floats where needed

For more information check the project page:
https://github.com/edubart/lua-bint/

And it's documentation:
https://edubart.github.io/lua-bint/

It is available in luarocks.

--
Eduardo Bart