Giter Club home page Giter Club logo

bigint.lua's People

Contributors

empyreuma avatar nimblz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bigint.lua's Issues

Division carries over leading 0 in dividend.

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.

division broken?

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

Bitwise operations

Thanks for creating bitint for Lua. Any plans to add support bitwise operations (e.g &, |, ~ ) ?

It is possible to get negative 0.

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().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.