A small arbitrary precision integer Lua library, with a paranoid and extensive test suite using Haskell's native arbitrary precision integers, QuickCheck and HsLua.
local I = require("bigint")
local a = I.fromstring("78840069980359889583804398923873743190317791505792283599345825435746711")
local b = I.fromstring("6952646245343968493900761108507")
local c = I.fromstring("-8177365527942")
local d = I.fromstring("364781755081040559817863568837659573725854950265808819869491980")
local f = 7319870
print((a - b - 1)//(c + 1) + (d % f))-9641255452134745719230413362696917903840332893074689350422
Download bigint.lua from the latest release and chuck it into Lua:
lua -l I=bigint -e 'print(I.build_info)'Or grab the latest pre-release using gh
gh release download "$(gh release list --json tagName --jq '.[0].tagName')" --pattern bigint.lua./mk-dist && ls dist
- download and verify the Lua version specified in the
deps/lua/lua.jsonfile, - builds both 32 and 64 bit versions and select which depending on the
LUA_BITSenvironment variable, - and adds the
srcdirectory to Lua'spackage.path.