empyreuma / bigint.lua Goto Github PK
View Code? Open in Web Editor NEWLibrary to provide native, big integer operations in Lua
License: Other
Library to provide native, big integer operations in Lua
License: Other
In the middle of a calculation, if the local dividend and divisor evenly divide with no remainder, in the next iteration of the loop, the divisor will start as 0, and when the next digit is added on (say 6), it will be 06.
I am new to Lua so maybe I am doing wrong here
Thanks in advance :)
local prime = u64.new("7346545015") -- utility.lua:112
for i = 1, 64 do -- utility.lua:113
print(u64.unserialize(prime, 's')) -- utility.lua:114
prime = u64.divide(prime, u64.new(2)) -- utility.lua:115
end -- utility.lua:116
luajit: .\bigint.lua:79: 12 is greater than or equal to 10
stack traceback:
[C]: in function 'assert'
.\bigint.lua:79: in function 'check'
.\bigint.lua:96: in function 'unserialize'
.\utility.lua:114: in function 'fnv1a'
.\utility.lua:149: in main chunk
[C]: in function 'require'
demo.lua:1: in main chunk
[C]: at 0x013fd12490
7346545015
Thanks for creating bitint for Lua. Any plans to add support bitwise operations (e.g &, |, ~ ) ?
Due to the way the sign is assigned to the result in bigint.add(), it is possible to get a result of -0 when using bigint.subtract().
5442323 / 1 = 5000000 and -0442323
5442323 / 2 = 2700000 and -042323
5442323 % 2 = 2700000 ๐
-_-
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.