Giter Site home page Giter Site logo

integer-arithmetic's People

Contributors

bassie0 avatar jorritolthuis avatar laityned avatar s132970 avatar

Watchers

 avatar  avatar

integer-arithmetic's Issues

Carry bug

Currently it only possible to have a carry of 1. In theory we could have D+E (hexadecimal) as input. This would convert to 13+14 = 27 (carry of 2). Hence, our result will be 11 whereas the answer should be 1B.

Karatsuba output is incorrect

The output of multiply, add and subtract are correct. This means there must be a mistake in the method of Karatsuba itself.

NullPointerException in Add

When giving multiple inputs to Add, a NullPointerException is triggered at the first if-statement (i.e. x or y seems null).
I am not sure if this is caused by commit b16e1fe.

Comments in Add

The Add class can use some more comments, to me it's not clear what happens.

Copying remaining part of the string

Copying remaining part goes wrong on two part:

if there isn't a carry or when there is a carry but next number is the highest number in the base

Error in adding positive and negative number

When running Karatsuba, there is an instance at which it needs to add 1000 and -00100 in radix 2. It calls subtract after which an error is thrown.

image
Edit: The line numbers of Karatsuba might have shifted

Input: (or just giving -f ./test/example.txt as argument when running)

[radix] 2 
[karatsuba]
[x] 1111001110011011011101001100010101111000011010100100001101011101111101101110010001111010001010110011
[y] 1110110000001110100000101100010100101010110001101100011011101000101001001001000100001111010100100110
# [answer] 11100000101000010001111010010110111111100111000001010111101100100100001100000010011011111001001001111100000010010100100011101011001011000101101001100010110001000001001000100011100001110111010110010010

Directly giving the following input as command also results in the same error: (is the reduced version of the problem)

[radix] 2
[add]
[x] 1000
[y] -00100
end

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.