Giter Site home page Giter Site logo

Comments (19)

OmriHab avatar OmriHab commented on June 15, 2024 2

Can i recommend using uint64_t from cstdint, instead of unsigned long long?
unsigned long long is promised to be at least 64 bit but not certainly exactly 64.
I assume that could create some problems if you use calculations that assume base 2^64.

from bigint.

surajumang avatar surajumang commented on June 15, 2024 2

if you are implementing any feature then probably you should create a issue and then implement that particular feature like first create issue Implement sum of BigInts in vectorized implementation and then sumbit PR for that particular issue. This way different people can work on it

from bigint.

surajumang avatar surajumang commented on June 15, 2024

The idea of using numbers in base 2^64 seems interesting. But the representation you have used is quite opposite of what is used commonly i.e Leftmost digit is the most significant one and rightmost digit is the least significant. Is there any reason behind this choice?

from bigint.

faheel avatar faheel commented on June 15, 2024

@surajumang Since all arithmetic operations (except division) are done from right to left, it's simpler to store the right-most digit as the first digit in an array since it will be processed first. But this is just to make the code simpler. When written formally, the most significant digits are always written first, followed by less significant digits to the right.

from bigint.

surajumang avatar surajumang commented on June 15, 2024

I would like to work on this but think it will require a complete overhaul of the existing codebase like redefining all the arithmetic operations. What do you say?

from bigint.

faheel avatar faheel commented on June 15, 2024

@surajumang Yes, it would require a complete rewrite of all the arithmetic operators and a few other methods.

I'll be creating a new branch and will implement some basic stuff like converting from base 10 to base 264. Once that's done, I'll notify you and you can contribute to that branch.

from bigint.

faheel avatar faheel commented on June 15, 2024

@SingleJourney English please! Google Translate isn't perfect :)

from bigint.

OmriHab avatar OmriHab commented on June 15, 2024

Could you let me know when you've added that branch?
I would like to help contribute to the math functions using the new representation and anything else.

from bigint.

faheel avatar faheel commented on June 15, 2024

@surajumang @OmriHab I've added the branch base-2-to-the-64. The changes made so far on this branch can be tracked by comparing the branch with master.

from bigint.

OmriHab avatar OmriHab commented on June 15, 2024

Alternatively unsigned long long can be used and just take into consideration that it isn't necessarily 64 bit.
E.g the maximum would be numeric_limits<unsigned long long>::max() instead of UINT_64_MAX

from bigint.

faheel avatar faheel commented on June 15, 2024

@OmriHab Good suggestion! I'll change the type to uint64_t.

from bigint.

ankur54 avatar ankur54 commented on June 15, 2024

Is the issue still open? If it is, I will start working on it.

from bigint.

DarkenedOrigins avatar DarkenedOrigins commented on June 15, 2024

Hi, I see the issue as open but seeing as its been over a year I would like to touch base and ask what I should work on as I would like to help.

from bigint.

faheel avatar faheel commented on June 15, 2024

@DarkenedOrigins If you're interested in working on it then I would be glad to help you by reviewing the code and helping with the logic.

You can start by creating a draft PR in which you can implement a utility function that takes a string representation of an integer and converts it to its base 2⁢⁴ integer vector representation.

If anyone else is interested in working on this too then they can contribute in the same PR.

from bigint.

DarkenedOrigins avatar DarkenedOrigins commented on June 15, 2024

Awesome, would you prefer that I create this in its own class called BigInt64 or i bolt it on to the current implementation

from bigint.

faheel avatar faheel commented on June 15, 2024

@DarkenedOrigins The existing class can be renamed to BigIntString and then you can create a new BigInt class.

from bigint.

DarkenedOrigins avatar DarkenedOrigins commented on June 15, 2024

inorder to be less destructive I made a new class called BigInt64. My implementation actually uses the string based BigInt internally. The only problem I had was difficulty in compiling since I have never used cmake before nor have I worked with such fragmented code where each implementation almost has its own file. Some help would be greatly appreciated.

from bigint.

faheel avatar faheel commented on June 15, 2024

inorder to be less destructive I made a new class called BigInt64

Good call! We can do the renaming later.

The only problem I had was difficulty in compiling [...]

Yeah, the documentation related to development is not very good at the moment. I'll add details regarding how and when to create a new header file, how to write tests for it, and how to compile and run the tests using CMake and CTest. If you need help on anything more specific, you can leave a comment in PR #58 that you opened and @mention me in it. I'll get back to you whenever I can.

from bigint.

szdytom avatar szdytom commented on June 15, 2024

use std:bitset<>, long long calculations are much slower than 2 ints on some CPU.

from bigint.

Related Issues (20)

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.